Created
January 9, 2015 00:27
-
-
Save digorithm/b99fdd6bc698d133f33e 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
public double deriveTheta1(){ | |
double sum = 0; | |
for (int j=0; j<initial_data.x.length; j++){ | |
sum += (initial_data.y[j] - hypothesisFunction(initial_data.x[j])) * initial_data.x[j]; | |
} | |
return -2 * sum / initial_data.x.length; | |
} | |
public double deriveTheta0(){ | |
double sum = 0; | |
for (int j=0; j<initial_data.x.length; j++) { | |
sum += initial_data.y[j] - hypothesisFunction(initial_data.x[j]); | |
} | |
return -2 * sum / initial_data.x.length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment