Skip to content

Commit

Permalink
Merge pull request huggingface#10 from guidogallopyn/patch-1
Browse files Browse the repository at this point in the history
Update 05_1_gradientdescent_manually.py
  • Loading branch information
patrickloeber authored Jan 5, 2023
2 parents 75d768b + c3b0a21 commit cc18036
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 05_1_gradientdescent_manually.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def loss(y, y_pred):
# J = MSE = 1/N * (w*x - y)**2
# dJ/dw = 1/N * 2x(w*x - y)
def gradient(x, y, y_pred):
return np.dot(2*x, y_pred - y).mean()
return np.mean(2*x*(y_pred - y))

print(f'Prediction before training: f(5) = {forward(5):.3f}')

Expand Down

0 comments on commit cc18036

Please sign in to comment.