Created
January 8, 2016 16:53
-
-
Save perborgen/328415f094b0ee3d4f4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Cost_Function_Derivative(X,Y,theta,j,m,alpha): | |
sumErrors = 0 | |
for i in xrange(m): | |
xi = X[i] | |
xij = xi[j] | |
hi = Hypothesis(theta,X[i]) | |
error = (hi - Y[i])*xij | |
sumErrors += error | |
m = len(Y) | |
constant = float(alpha)/float(m) | |
J = constant * sumErrors | |
return J |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment