adding dft slides

This commit is contained in:
Morten Hjorth-Jensen
2023-10-25 15:38:49 +02:00
parent 248fa398fc
commit 9587aff02c
142 changed files with 2211 additions and 3328 deletions
+124 -116
View File
@@ -333,6 +333,16 @@ const thebe_selector_output = ".output, .cell_output"
Week 42 Constructing a Neural Network code with introduction to Tensor flow
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="exercisesweek43.html">
Exercises weeks 43 and 44
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week43.html">
Week 43: Deep Learning: Constructing a Neural Network code and solving differential equations
</a>
</li>
</ul>
<p aria-level="2" class="caption" role="heading">
<span class="caption-text">
@@ -804,15 +814,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
[[3.89481038]
[3.13155259]]
Eigenvalues of Hessian Matrix:[0.28194659 4.81122914]
[[3.97739698]
[2.9189726 ]]
Eigenvalues of Hessian Matrix:[0.27987128 4.51549827]
theta from own gd
[[3.89481038]
[3.13155259]]
[[3.97739698]
[2.9189726 ]]
theta from own sdg
[[3.88291866]
[3.19123037]]
[[3.9577228 ]
[2.91473433]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_5_1.png" src="_images/exercisesweek41_5_1.png" />
@@ -934,14 +944,14 @@ 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
[[4.23636536]
[2.77184871]]
Eigenvalues of Hessian Matrix:[0.30125775 4.66878535]
[[4.32133765]
[2.59905073]]
Eigenvalues of Hessian Matrix:[0.29426584 4.28858038]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
[[4.23636536]
[2.77184871]]
[[4.32133765]
[2.59905073]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_16_2.png" src="_images/exercisesweek41_16_2.png" />
@@ -1012,73 +1022,73 @@ Eigenvalues of Hessian Matrix:[0.30125775 4.66878535]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.]
[3.]]
Eigenvalues of Hessian Matrix:[0.35058127 4.29679459]
0 [-8.31895514] [-8.15055258]
1 [-0.75472506] [0.63957747]
2 [-0.69314603] [0.58739348]
3 [-0.63659131] [0.53946725]
4 [-0.58465096] [0.49545139]
5 [-0.5369485] [0.45502684]
6 [-0.49313815] [0.41790059]
7 [-0.45290234] [0.38380352]
8 [-0.41594943] [0.35248847]
9 [-0.38201155] [0.32372846]
10 [-0.35084272] [0.29731502]
11 [-0.32221699] [0.27305669]
12 [-0.29592687] [0.25077762]
13 [-0.2717818] [0.23031634]
14 [-0.24960675] [0.21152452]
15 [-0.229241] [0.19426595]
16 [-0.21053692] [0.17841553]
17 [-0.19335893] [0.16385836]
18 [-0.17758251] [0.15048894]
19 [-0.16309331] [0.13821034]
20 [-0.14978631] [0.12693357]
21 [-0.13756504] [0.11657689]
22 [-0.12634093] [0.10706523]
23 [-0.1160326] [0.09832963]
24 [-0.10656534] [0.09030678]
25 [-0.09787053] [0.08293853]
26 [-0.08988514] [0.07617146]
27 [-0.08255129] [0.06995653]
28 [-0.07581582] [0.06424868]
29 [-0.06962991] [0.05900655]
Eigenvalues of Hessian Matrix:[0.30311767 4.03556032]
0 [-14.28624958] [-15.54071847]
1 [-0.04900086] [0.04473913]
2 [-0.04532032] [0.0413787]
3 [-0.04191624] [0.03827068]
4 [-0.03876784] [0.0353961]
5 [-0.03585592] [0.03273744]
6 [-0.03316272] [0.03027848]
7 [-0.03067182] [0.02800421]
8 [-0.02836801] [0.02590077]
9 [-0.02623724] [0.02395532]
10 [-0.02426651] [0.022156]
11 [-0.02244382] [0.02049182]
12 [-0.02075802] [0.01895265]
13 [-0.01919885] [0.01752908]
14 [-0.0177568] [0.01621244]
15 [-0.01642305] [0.0149947]
16 [-0.01518949] [0.01386842]
17 [-0.01404858] [0.01282674]
18 [-0.01299337] [0.0118633]
19 [-0.01201742] [0.01097223]
20 [-0.01111477] [0.01014809]
21 [-0.01027992] [0.00938585]
22 [-0.00950778] [0.00868086]
23 [-0.00879363] [0.00802883]
24 [-0.00813313] [0.00742577]
25 [-0.00752224] [0.00686801]
26 [-0.00695723] [0.00635214]
27 [-0.00643466] [0.00587502]
28 [-0.00595134] [0.00543374]
29 [-0.00550433] [0.0050256]
theta from own gd
[[3.81759234]
[3.15457792]]
0 [-0.06394871] [0.05419212]
1 [-0.05873105] [0.04977051]
2 [-0.0523738] [0.04438319]
3 [-0.04619338] [0.03914571]
4 [-0.04057027] [0.03438051]
5 [-0.03557316] [0.0301458]
6 [-0.03117156] [0.02641575]
7 [-0.02730775] [0.02314144]
8 [-0.02392053] [0.020271]
9 [-0.02095266] [0.01775594]
10 [-0.01835274] [0.01555268]
11 [-0.01607534] [0.01362274]
12 [-0.01408051] [0.01193226]
13 [-0.01233322] [0.01045155]
14 [-0.01080274] [0.00915458]
15 [-0.00946219] [0.00801855]
16 [-0.00828799] [0.0070235]
17 [-0.0072595] [0.00615193]
18 [-0.00635865] [0.00538851]
19 [-0.00556958] [0.00471983]
20 [-0.00487843] [0.00413413]
21 [-0.00427304] [0.00362111]
22 [-0.00374279] [0.00317175]
23 [-0.00327833] [0.00277816]
24 [-0.00287151] [0.00243341]
25 [-0.00251517] [0.00213144]
26 [-0.00220306] [0.00186694]
27 [-0.00192967] [0.00163526]
28 [-0.00169021] [0.00143234]
29 [-0.00148047] [0.00125459]
[[3.98320492]
[3.01533437]]
0 [-0.00509089] [0.00464812]
1 [-0.0047085] [0.00429899]
2 [-0.00424012] [0.00387135]
3 [-0.00378113] [0.00345227]
4 [-0.00335942] [0.00306724]
5 [-0.00298058] [0.00272135]
6 [-0.00264305] [0.00241318]
7 [-0.00234327] [0.00213947]
8 [-0.00207732] [0.00189665]
9 [-0.00184151] [0.00168135]
10 [-0.00163245] [0.00149047]
11 [-0.00144711] [0.00132125]
12 [-0.00128282] [0.00117125]
13 [-0.00113717] [0.00103827]
14 [-0.00100807] [0.00092039]
15 [-0.00089362] [0.0008159]
16 [-0.00079216] [0.00072326]
17 [-0.00070222] [0.00064115]
18 [-0.0006225] [0.00056836]
19 [-0.00055182] [0.00050383]
20 [-0.00048917] [0.00044663]
21 [-0.00043363] [0.00039592]
22 [-0.0003844] [0.00035097]
23 [-0.00034076] [0.00031112]
24 [-0.00030207] [0.0002758]
25 [-0.00026778] [0.00024449]
26 [-0.00023737] [0.00021673]
27 [-0.00021042] [0.00019212]
28 [-0.00018653] [0.00017031]
29 [-0.00016536] [0.00015097]
theta from own gd wth momentum
[[3.99630114]
[3.00313452]]
[[3.99951642]
[3.00044152]]
</pre></div>
</div>
</div>
@@ -1131,17 +1141,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.08185019]
[2.82781715]]
Eigenvalues of Hessian Matrix:[0.32244056 3.90871918]
0 [-14.19393543] [-14.29174301]
1 [-6.35255737e-15] [-1.10851799e-14]
2 [-5.89805982e-17] [-2.66490332e-16]
3 [9.81853487e-16] [1.10741066e-15]
4 [-5.89805982e-17] [-2.66490332e-16]
[[3.66959644]
[3.26513904]]
Eigenvalues of Hessian Matrix:[0.33285444 4.11450263]
0 [-12.48534921] [-14.7906583]
1 [-1.09712586e-14] [-5.19623863e-15]
2 [-1.27068495e-16] [-2.9424428e-16]
3 [5.91540705e-16] [7.2837521e-16]
4 [-1.27068495e-16] [-2.9424428e-16]
beta from own Newton code
[[4.08185019]
[2.82781715]]
[[3.66959644]
[3.26513904]]
</pre></div>
</div>
</div>
@@ -1230,20 +1240,18 @@ 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
[[3.41716708]
[3.50046106]]
Eigenvalues of Hessian Matrix:[0.24252405 4.30774404]
[[3.68184997]
[3.32507975]]
Eigenvalues of Hessian Matrix:[0.26370919 4.62518501]
theta from own gd
[[3.68184997]
[3.32507975]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
[[3.41716708]
[3.50046106]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_22_2.png" src="_images/exercisesweek41_22_2.png" />
<img alt="_images/exercisesweek41_22_1.png" src="_images/exercisesweek41_22_1.png" />
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
[[3.38135654]
[3.49216685]]
[[3.68809785]
[3.32032017]]
</pre></div>
</div>
</div>
@@ -1325,15 +1333,15 @@ Eigenvalues of Hessian Matrix:[0.24252405 4.30774404]
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.12427537]
[2.85355539]]
Eigenvalues of Hessian Matrix:[0.33486875 3.91080327]
[[3.55555773]
[3.41891092]]
Eigenvalues of Hessian Matrix:[0.30326262 4.34133193]
theta from own gd
[[4.12417157]
[2.85365229]]
[[3.55511609]
[3.41928689]]
theta from own sdg with momentum
[[4.25050227]
[2.8249367 ]]
[[3.58207928]
[3.37895549]]
</pre></div>
</div>
</div>
@@ -1408,9 +1416,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
[[1.99999773]
[3.0000164 ]
[3.99998703]]
[[2.00039962]
[2.99772199]
[4.00233436]]
</pre></div>
</div>
</div>
@@ -1492,9 +1500,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
[[2.01023308]
[2.95235306]
[4.04597076]]
[[1.99858411]
[2.9981377 ]
[3.99861427]]
</pre></div>
</div>
</div>
@@ -1580,9 +1588,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
[[1.99998193]
[3.0000747 ]
[3.99992263]]
[[2.00002678]
[2.99985103]
[4.00014662]]
</pre></div>
</div>
</div>
@@ -1655,7 +1663,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 0x10febc640&gt;]
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x1262b9a90&gt;]
</pre></div>
</div>
<img alt="_images/exercisesweek41_39_2.png" src="_images/exercisesweek41_39_2.png" />
@@ -1694,7 +1702,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.collections.PathCollection at 0x10febcf10&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x126323b50&gt;
</pre></div>
</div>
<img alt="_images/exercisesweek41_41_2.png" src="_images/exercisesweek41_41_2.png" />