update lecture notes

This commit is contained in:
Morten Hjorth-Jensen
2024-10-28 06:15:26 +01:00
parent d58daeae80
commit d6bb9335d0
158 changed files with 29822 additions and 2310 deletions
+119 -112
View File
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
Exercises week 43
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week44.html">
Week 44, Convolutional Neural Networks (CNN)
</a>
</li>
</ul>
<p aria-level="2" class="caption" role="heading">
<span class="caption-text">
@@ -819,15 +824,15 @@ regression.</p>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.15515965]
[2.99763835]]
Eigenvalues of Hessian Matrix:[0.3156062 4.19886862]
[[3.72796854]
[3.26269704]]
Eigenvalues of Hessian Matrix:[0.26876494 4.16606994]
theta from own gd
[[4.15515965]
[2.99763835]]
[[3.72796854]
[3.26269704]]
theta from own sdg
[[4.18290649]
[2.96486591]]
[[3.70521262]
[3.29966563]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_5_1.png" src="_images/exercisesweek41_5_1.png" />
@@ -949,12 +954,12 @@ first example shows results with ordinary leats squares.</p>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[3.98635543]
[2.9642492 ]]
Eigenvalues of Hessian Matrix:[0.31545424 4.4234122 ]
[[3.89549614]
[2.9788957 ]]
Eigenvalues of Hessian Matrix:[0.34210288 4.43495138]
theta from own gd
[[3.98635543]
[2.9642492 ]]
[[3.89549614]
[2.9788957 ]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_16_1.png" src="_images/exercisesweek41_16_1.png" />
@@ -1025,73 +1030,73 @@ theta from own gd
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.]
[3.]]
Eigenvalues of Hessian Matrix:[0.35350927 4.2330123 ]
0 [-10.02028415] [-11.38281882]
1 [-0.12978318] [0.11144292]
2 [-0.11894467] [0.10213605]
3 [-0.10901131] [0.09360642]
4 [-0.0999075] [0.08578912]
5 [-0.09156398] [0.07862466]
6 [-0.08391725] [0.07205852]
7 [-0.07690911] [0.06604073]
8 [-0.07048624] [0.06052551]
9 [-0.06459976] [0.05547088]
10 [-0.05920488] [0.05083837]
11 [-0.05426053] [0.04659273]
12 [-0.0497291] [0.04270166]
13 [-0.0455761] [0.03913554]
14 [-0.04176993] [0.03586723]
15 [-0.03828162] [0.03287187]
16 [-0.03508463] [0.03012666]
17 [-0.03215463] [0.02761071]
18 [-0.02946931] [0.02530487]
19 [-0.02700826] [0.0231916]
20 [-0.02475273] [0.02125481]
21 [-0.02268557] [0.01947977]
22 [-0.02079104] [0.01785297]
23 [-0.01905473] [0.01636202]
24 [-0.01746342] [0.01499559]
25 [-0.01600501] [0.01374327]
26 [-0.01466839] [0.01259554]
27 [-0.0134434] [0.01154365]
28 [-0.01232071] [0.01057961]
29 [-0.01129178] [0.00969608]
Eigenvalues of Hessian Matrix:[0.35622964 3.83344349]
0 [-10.84597523] [-10.53597191]
1 [-0.41603353] [0.39392645]
2 [-0.37737287] [0.35732012]
3 [-0.34230481] [0.32411551]
4 [-0.31049552] [0.29399649]
5 [-0.28164216] [0.26667634]
6 [-0.25547006] [0.24189496]
7 [-0.23173004] [0.21941643]
8 [-0.21019611] [0.19902677]
9 [-0.19066326] [0.18053184]
10 [-0.17294553] [0.1637556]
11 [-0.15687426] [0.14853831]
12 [-0.14229643] [0.13473512]
13 [-0.12907328] [0.12221462]
14 [-0.11707891] [0.11085761]
15 [-0.10619914] [0.10055596]
16 [-0.0963304] [0.09121162]
17 [-0.08737872] [0.08273561]
18 [-0.0792589] [0.07504726]
19 [-0.07189362] [0.06807336]
20 [-0.06521278] [0.06174752]
21 [-0.05915276] [0.05600952]
22 [-0.05365588] [0.05080473]
23 [-0.04866982] [0.04608361]
24 [-0.04414708] [0.04180121]
25 [-0.04004464] [0.03791676]
26 [-0.03632342] [0.03439327]
27 [-0.032948] [0.03119722]
28 [-0.02988625] [0.02829816]
29 [-0.02710901] [0.0256685]
theta from own gd
[[3.9707256]
[3.0251375]]
0 [-0.01034877] [0.00888634]
1 [-0.00948452] [0.00814422]
2 [-0.00843317] [0.00724144]
3 [-0.00741349] [0.00636586]
4 [-0.00648847] [0.00557155]
5 [-0.00566909] [0.00486797]
6 [-0.00494984] [0.00425036]
7 [-0.00432069] [0.00371011]
8 [-0.00377111] [0.0032382]
9 [-0.00329131] [0.0028262]
10 [-0.0028725] [0.00246657]
11 [-0.00250697] [0.0021527]
12 [-0.00218794] [0.00187876]
13 [-0.00190952] [0.00163967]
14 [-0.00166652] [0.00143102]
15 [-0.00145445] [0.00124891]
16 [-0.00126936] [0.00108998]
17 [-0.00110783] [0.00095127]
18 [-0.00096685] [0.00083022]
19 [-0.00084381] [0.00072457]
20 [-0.00073643] [0.00063236]
21 [-0.00064272] [0.00055189]
22 [-0.00056093] [0.00048166]
23 [-0.00048955] [0.00042037]
24 [-0.00042725] [0.00036687]
25 [-0.00037288] [0.00032019]
26 [-0.00032543] [0.00027944]
27 [-0.00028402] [0.00024388]
28 [-0.00024787] [0.00021284]
29 [-0.00021633] [0.00018576]
[[3.93097189]
[3.06536011]]
0 [-0.02458986] [0.02328321]
1 [-0.0223048] [0.02111958]
2 [-0.01954657] [0.01850791]
3 [-0.0169027] [0.01600453]
4 [-0.01453883] [0.01376627]
5 [-0.01247862] [0.01181553]
6 [-0.01070096] [0.01013233]
7 [-0.00917325] [0.00868581]
8 [-0.0078625] [0.00744471]
9 [-0.00673864] [0.00638056]
10 [-0.00577528] [0.00546839]
11 [-0.00494959] [0.00468658]
12 [-0.00424194] [0.00401653]
13 [-0.00363545] [0.00344227]
14 [-0.00311567] [0.00295011]
15 [-0.00267021] [0.00252832]
16 [-0.00228844] [0.00216684]
17 [-0.00196125] [0.00185703]
18 [-0.00168084] [0.00159152]
19 [-0.00144052] [0.00136398]
20 [-0.00123456] [0.00116896]
21 [-0.00105805] [0.00100183]
22 [-0.00090678] [0.00085859]
23 [-0.00077713] [0.00073584]
24 [-0.00066602] [0.00063063]
25 [-0.0005708] [0.00054047]
26 [-0.00048919] [0.00046319]
27 [-0.00041925] [0.00039697]
28 [-0.0003593] [0.00034021]
29 [-0.00030793] [0.00029157]
theta from own gd wth momentum
[[3.99946593]
[3.0004586 ]]
[[3.99925917]
[3.00070146]]
</pre></div>
</div>
</div>
@@ -1144,17 +1149,17 @@ theta from own gd wth momentum
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.16849001]
[3.03642937]]
Eigenvalues of Hessian Matrix:[0.3039241 4.51493779]
0 [-12.93402104] [-15.39497785]
1 [9.11944131e-15] [7.63687445e-15]
2 [2.11636264e-16] [3.19670115e-16]
3 [2.11636264e-16] [3.19670115e-16]
4 [2.11636264e-16] [3.19670115e-16]
[[3.86751196]
[3.13877544]]
Eigenvalues of Hessian Matrix:[0.29322629 4.30627615]
0 [-14.05912765] [-16.736807]
1 [-2.16077156e-14] [-1.19631285e-14]
2 [-1.70002901e-16] [-1.23687362e-16]
3 [-1.70002901e-16] [-1.23687362e-16]
4 [-1.70002901e-16] [-1.23687362e-16]
beta from own Newton code
[[4.16849001]
[3.03642937]]
[[3.86751196]
[3.13877544]]
</pre></div>
</div>
</div>
@@ -1243,20 +1248,22 @@ beta from own Newton code
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.37133465]
[2.74809387]]
Eigenvalues of Hessian Matrix:[0.32760411 4.2384333 ]
[[3.90340018]
[3.20732292]]
Eigenvalues of Hessian Matrix:[0.30252911 4.09446058]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
[[4.37133465]
[2.74809387]]
[[3.90340018]
[3.20732292]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_22_2.png" src="_images/exercisesweek41_22_2.png" />
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
[[4.31985268]
[2.72067593]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[3.86364839]
[3.23799188]]
</pre></div>
</div>
</div>
@@ -1338,15 +1345,15 @@ Eigenvalues of Hessian Matrix:[0.32760411 4.2384333 ]
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.34039341]
[2.74045887]]
Eigenvalues of Hessian Matrix:[0.31262618 4.15129596]
[[4.38463079]
[2.57169626]]
Eigenvalues of Hessian Matrix:[0.27355018 4.06502525]
theta from own gd
[[4.340226 ]
[2.74060714]]
[[4.38343773]
[2.57278714]]
theta from own sdg with momentum
[[4.30982672]
[2.69332574]]
[[4.35254442]
[2.58244397]]
</pre></div>
</div>
</div>
@@ -1421,9 +1428,9 @@ theta from own sdg with momentum
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own AdaGrad
[[2.0009282 ]
[2.99447213]
[4.00526145]]
[[2.0000375 ]
[2.99981967]
[4.00017395]]
</pre></div>
</div>
</div>
@@ -1505,9 +1512,9 @@ theta from own sdg with momentum
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own RMSprop
[[1.99998409]
[2.99993515]
[4.00003694]]
[[1.99998686]
[2.9995237 ]
[4.00046845]]
</pre></div>
</div>
</div>
@@ -1593,9 +1600,9 @@ theta from own sdg with momentum
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own ADAM
[[2.00011851]
[2.99937234]
[4.00068042]]
[[1.99990776]
[3.0005044 ]
[3.99956442]]
</pre></div>
</div>
</div>
@@ -1668,7 +1675,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
return asarray(x, dtype=self.dtype)
</pre></div>
</div>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x125606520&gt;]
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x11edfa8b0&gt;]
</pre></div>
</div>
<img alt="_images/exercisesweek41_39_2.png" src="_images/exercisesweek41_39_2.png" />
@@ -1703,7 +1710,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x1253cc610&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x11ef1aac0&gt;
</pre></div>
</div>
<img alt="_images/exercisesweek41_41_1.png" src="_images/exercisesweek41_41_1.png" />