Created
March 19, 2018 19:10
-
-
Save yvan-sraka/3ef5fa0d6bc1ec1131b29865dc3d1bf6 to your computer and use it in GitHub Desktop.
Gradient Descent
This file contains hidden or 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 gradient_descent(point,step_size,threshold): | |
value = f(point) | |
new_point = point - step_size * gradient(point) | |
new_value = f(new_point) | |
if abs(new_value - value) < threshold: | |
return value | |
return gradient_descent(new_point,step_size,threshold) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment