diff --git a/doc/pub/week40/html/._week40-bs012.html b/doc/pub/week40/html/._week40-bs012.html
index efcfdd25b..59ac9c0b4 100644
--- a/doc/pub/week40/html/._week40-bs012.html
+++ b/doc/pub/week40/html/._week40-bs012.html
@@ -319,11 +319,11 @@ MathJax.Hub.Config({
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
-n = 100
+n = 1000
x = 2*np.random.rand(n,1)
y = 4+3*x+np.random.randn(n,1)
-X = np.c_[np.ones((m,1)), x]
+X = np.c_[np.ones((n,1)), x]
theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
print("Own inversion")
print(theta_linreg)
@@ -364,7 +364,7 @@ theta = np.= np.random.randint(m)
xi = X[random_index:random_index+1]
yi = y[random_index:random_index+1]
- gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)
+ gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients
print("theta from own sdg")
diff --git a/doc/pub/week40/html/week40-reveal.html b/doc/pub/week40/html/week40-reveal.html
index 0cee2bee7..b271cd4fd 100644
--- a/doc/pub/week40/html/week40-reveal.html
+++ b/doc/pub/week40/html/week40-reveal.html
@@ -436,11 +436,11 @@ We note that we have defined several hyperparameters. These are now the number o
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
-n = 100
+n = 1000
x = 2*np.random.rand(n,1)
y = 4+3*x+np.random.randn(n,1)
-X = np.c_[np.ones((m,1)), x]
+X = np.c_[np.ones((n,1)), x]
theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
print("Own inversion")
print(theta_linreg)
@@ -481,7 +481,7 @@ theta = np.random.randn(2,1]
yi = y[random_index:random_index+1]
- gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)
+ gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients
print("theta from own sdg")
diff --git a/doc/pub/week40/html/week40-solarized.html b/doc/pub/week40/html/week40-solarized.html
index 2ad884dd5..917133f75 100644
--- a/doc/pub/week40/html/week40-solarized.html
+++ b/doc/pub/week40/html/week40-solarized.html
@@ -525,11 +525,11 @@ We note that we have defined several hyperparameters. These are now the number o
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
-n = 100
+n = 1000
x = 2*np.random.rand(n,1)
y = 4+3*x+np.random.randn(n,1)
-X = np.c_[np.ones((m,1)), x]
+X = np.c_[np.ones((n,1)), x]
theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
print("Own inversion")
print(theta_linreg)
@@ -570,7 +570,7 @@ theta = np.random.randn(2,1]
yi = y[random_index:random_index+1]
- gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)
+ gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients
print("theta from own sdg")
diff --git a/doc/pub/week40/html/week40.html b/doc/pub/week40/html/week40.html
index 0bb83f2fb..e9ed59b8a 100644
--- a/doc/pub/week40/html/week40.html
+++ b/doc/pub/week40/html/week40.html
@@ -530,11 +530,11 @@ We note that we have defined several hyperparameters. These are now the number o
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
-n = 100
+n = 1000
x = 2*np.random.rand(n,1)
y = 4+3*x+np.random.randn(n,1)
-X = np.c_[np.ones((m,1)), x]
+X = np.c_[np.ones((n,1)), x]
theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
print("Own inversion")
print(theta_linreg)
@@ -575,7 +575,7 @@ theta = np.= np.random.randint(m)
xi = X[random_index:random_index+1]
yi = y[random_index:random_index+1]
- gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)
+ gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients
print("theta from own sdg")
diff --git a/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz b/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz
index e1c7ba345..912b3cb08 100644
Binary files a/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz and b/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz differ
diff --git a/doc/pub/week40/ipynb/week40.ipynb b/doc/pub/week40/ipynb/week40.ipynb
index 4e1233143..60cfea892 100644
--- a/doc/pub/week40/ipynb/week40.ipynb
+++ b/doc/pub/week40/ipynb/week40.ipynb
@@ -311,11 +311,11 @@
"import matplotlib.pyplot as plt\n",
"from sklearn.linear_model import SGDRegressor\n",
"\n",
- "n = 100\n",
+ "n = 1000\n",
"x = 2*np.random.rand(n,1)\n",
"y = 4+3*x+np.random.randn(n,1)\n",
"\n",
- "X = np.c_[np.ones((m,1)), x]\n",
+ "X = np.c_[np.ones((n,1)), x]\n",
"theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)\n",
"print(\"Own inversion\")\n",
"print(theta_linreg)\n",
@@ -356,7 +356,7 @@
" random_index = np.random.randint(m)\n",
" xi = X[random_index:random_index+1]\n",
" yi = y[random_index:random_index+1]\n",
- " gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)\n",
+ " gradients = 2.0* xi.T @ ((xi @ theta)-yi)\n",
" eta = learning_schedule(epoch*m+i)\n",
" theta = theta - eta*gradients\n",
"print(\"theta from own sdg\")\n",
diff --git a/doc/src/week40/week40.do.txt b/doc/src/week40/week40.do.txt
index cc16ff576..bbdf5f9af 100644
--- a/doc/src/week40/week40.do.txt
+++ b/doc/src/week40/week40.do.txt
@@ -236,11 +236,11 @@ import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDRegressor
-n = 100
+n = 1000
x = 2*np.random.rand(n,1)
y = 4+3*x+np.random.randn(n,1)
-X = np.c_[np.ones((m,1)), x]
+X = np.c_[np.ones((n,1)), x]
theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
print("Own inversion")
print(theta_linreg)
@@ -281,7 +281,7 @@ for epoch in range(n_epochs):
random_index = np.random.randint(m)
xi = X[random_index:random_index+1]
yi = y[random_index:random_index+1]
- gradients = (2.0/m) * xi.T @ ((xi @ theta)-yi)
+ gradients = 2.0* xi.T @ ((xi @ theta)-yi)
eta = learning_schedule(epoch*m+i)
theta = theta - eta*gradients
print("theta from own sdg")