Skip to content

Instantly share code, notes, and snippets.

@yvan-sraka
Created March 19, 2018 19:10
Show Gist options
  • Save yvan-sraka/3ef5fa0d6bc1ec1131b29865dc3d1bf6 to your computer and use it in GitHub Desktop.
Save yvan-sraka/3ef5fa0d6bc1ec1131b29865dc3d1bf6 to your computer and use it in GitHub Desktop.
Gradient Descent
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