updating week40 and typos

This commit is contained in:
Morten Hjorth-Jensen
2021-11-02 22:02:24 +01:00
parent 4689a1b48b
commit 80ebc07a69
73 changed files with 4631 additions and 4069 deletions
+2 -2
View File
@@ -280,8 +280,8 @@ theta = np.random.randn(2,1)
for epoch in range(n_epochs):
for i in range(m):
random_index = np.random.randint(m)
xi = X[random_index:random_index+1]
yi = y[random_index:random_index+1]
xi = X[random_index:random_index+m]
yi = y[random_index:random_index+m]
gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients