Skip to content

Commit 1f46a2b

Browse files
committed
Merge pull request joelgrus#12 from e9t/original
Fix error in gradient descent code
2 parents 966d2e3 + dd66070 commit 1f46a2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

code/gradient_descent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def sum_of_squares(v):
1010
def difference_quotient(f, x, h):
1111
return (f(x + h) - f(x)) / h
1212

13-
def plot_estimated_derivative(plt):
13+
def plot_estimated_derivative():
1414

1515
def square(x):
1616
return x * x
1717

1818
def derivative(x):
1919
return 2 * x
2020

21-
derivative_estimate = partial(difference_quotient, square, h=0.00001)
21+
derivative_estimate = lambda x: difference_quotient(square, x, h=0.00001)
2222

2323
# plot to show they're basically the same
2424
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)