Last active
March 11, 2020 18:16
-
-
Save ramonrosa/a6279fe81d30a7f511cde1f468a1ddcd 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 funcao_custo(theta, X, y): | |
m = len(y) | |
y_pred = X.dot(theta).flatten() | |
J = (1/m)*np.sum((y-y_pred)**2) | |
gradiente = -(2/m)*((X.T).dot(y - y_pred)).flatten() | |
return J, gradiente |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment