Created
May 6, 2018 09:01
-
-
Save jainanchit51/55cb48ade62314fbbba2de356e472d3b 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_calculation(self,X,y,theta): | |
inner = np.power(((X @ theta.T) - y), 2) # @ means matrix multiplication of arrays. If we want to use * for multiplication we will have to convert all arrays to matrices | |
return np.sum(inner) / (2 * len(X)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment