Skip to content

Commit cee5f8e

Browse files
committed
Update week37.ipynb
1 parent 7a05286 commit cee5f8e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/pub/week37/ipynb/week37.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,7 +3518,7 @@
35183518
},
35193519
{
35203520
"cell_type": "code",
3521-
"execution_count": 10,
3521+
"execution_count": 6,
35223522
"id": "2ed0cafc",
35233523
"metadata": {
35243524
"collapsed": false,
@@ -3539,12 +3539,12 @@
35393539
"0.004113634617443139\n",
35403540
"MSE with intercept column from SKL\n",
35413541
"0.004113634617443147\n",
3542-
"Manual intercept: 2.083766322923907\n",
3542+
"Manual intercept: 2.083766322923899\n",
35433543
"Fitted theta (without intercept): [0.19569961 3.97898392]\n",
35443544
"Sklearn intercept: 2.0837663229239043\n",
35453545
"Sklearn fitted theta (without intercept): [0.19569961 3.97898392]\n",
35463546
"MSE with Manual intercept\n",
3547-
"4.346195723169266\n",
3547+
"0.00411363461744314\n",
35483548
"MSE with Sklearn intercept\n",
35493549
"0.004113634617443131\n"
35503550
]
@@ -3627,7 +3627,7 @@
36273627
"y_offset = np.average(y, axis=0)\n",
36283628
"X_offset = np.average(X, axis=0)\n",
36293629
"\n",
3630-
"theta = fit_theta(X - X_offset, y)#-y_offset)\n",
3630+
"theta = fit_theta(X - X_offset, y-y_offset)\n",
36313631
"intercept = np.mean(y_offset - X_offset @ theta)\n",
36323632
"\n",
36333633
"print(f\"Manual intercept: {intercept}\")\n",
@@ -3637,7 +3637,7 @@
36373637
"ypredictOwn = X @ theta\n",
36383638
"ypredictSKL = skl.predict(X)\n",
36393639
"print(f\"MSE with Manual intercept\")\n",
3640-
"print(MSE(y,ypredictOwn))#+intercept))\n",
3640+
"print(MSE(y,ypredictOwn+intercept))\n",
36413641
"print(f\"MSE with Sklearn intercept\")\n",
36423642
"print(MSE(y,ypredictSKL))\n",
36433643
"\n",
@@ -3745,7 +3745,7 @@
37453745
},
37463746
{
37473747
"cell_type": "code",
3748-
"execution_count": 11,
3748+
"execution_count": 4,
37493749
"id": "4f9b1fa0",
37503750
"metadata": {
37513751
"collapsed": false,
@@ -3943,7 +3943,7 @@
39433943
},
39443944
{
39453945
"cell_type": "code",
3946-
"execution_count": 12,
3946+
"execution_count": 5,
39473947
"id": "a731e32c",
39483948
"metadata": {
39493949
"collapsed": false,

0 commit comments

Comments
 (0)