last update, perhaps

This commit is contained in:
Morten Hjorth-Jensen
2024-10-14 13:54:09 +02:00
parent 7d4725e646
commit 0bc2e08294
52 changed files with 2146 additions and 1626 deletions
+117 -117
View File
@@ -804,15 +804,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.1729993]
[3.0170097]]
Eigenvalues of Hessian Matrix:[0.28192769 4.68753434]
[[3.99556258]
[2.99418621]]
Eigenvalues of Hessian Matrix:[0.29411652 4.64408368]
theta from own gd
[[4.1729993]
[3.0170097]]
[[3.99556258]
[2.99418621]]
theta from own sdg
[[4.14043884]
[2.99071523]]
[[4.03364384]
[2.99870462]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_5_1.png" src="_images/exercisesweek41_5_1.png" />
@@ -934,14 +934,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.03696458]
[3.0324793 ]]
Eigenvalues of Hessian Matrix:[0.30959659 4.4150026 ]
[[3.94033034]
[3.07147868]]
Eigenvalues of Hessian Matrix:[0.26240613 4.76140219]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
[[4.03696458]
[3.0324793 ]]
[[3.94033034]
[3.07147868]]
</pre></div>
</div>
<img alt="_images/exercisesweek41_16_2.png" src="_images/exercisesweek41_16_2.png" />
@@ -1012,73 +1012,73 @@ Eigenvalues of Hessian Matrix:[0.30959659 4.4150026 ]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[4.]
[3.]]
Eigenvalues of Hessian Matrix:[0.23469347 4.90407685]
0 [-18.02987043] [-22.42501752]
1 [-0.32329897] [0.25206371]
2 [-0.30782691] [0.24000075]
3 [-0.2930953] [0.22851508]
4 [-0.27906869] [0.21757908]
5 [-0.26571335] [0.20716644]
6 [-0.25299716] [0.19725211]
7 [-0.24088952] [0.18781225]
8 [-0.22936132] [0.17882416]
9 [-0.21838482] [0.17026621]
10 [-0.20793362] [0.16211781]
11 [-0.19798258] [0.15435937]
12 [-0.18850776] [0.14697222]
13 [-0.17948638] [0.1399386]
14 [-0.17089674] [0.13324158]
15 [-0.16271817] [0.12686507]
16 [-0.15493099] [0.12079371]
17 [-0.14751649] [0.11501291]
18 [-0.14045682] [0.10950876]
19 [-0.13373501] [0.10426802]
20 [-0.12733488] [0.09927808]
21 [-0.12124104] [0.09452695]
22 [-0.11543883] [0.09000319]
23 [-0.10991429] [0.08569593]
24 [-0.10465415] [0.08159479]
25 [-0.09964573] [0.07768993]
26 [-0.094877] [0.07397193]
27 [-0.09033649] [0.07043187]
28 [-0.08601328] [0.06706123]
29 [-0.08189696] [0.06385189]
Eigenvalues of Hessian Matrix:[0.30332201 4.25820894]
0 [-14.184119] [-15.76632434]
1 [-0.27465664] [0.23807169]
2 [-0.25509222] [0.2211133]
3 [-0.23692142] [0.20536289]
4 [-0.22004496] [0.19073442]
5 [-0.20437065] [0.17714797]
6 [-0.18981286] [0.16452931]
7 [-0.17629205] [0.15280951]
8 [-0.16373437] [0.14192454]
9 [-0.15207119] [0.13181493]
10 [-0.14123881] [0.12242545]
11 [-0.13117805] [0.1137048]
12 [-0.12183393] [0.10560535]
13 [-0.11315542] [0.09808284]
14 [-0.1050951] [0.09109617]
15 [-0.09760893] [0.08460718]
16 [-0.09065603] [0.07858042]
17 [-0.08419839] [0.07298295]
18 [-0.07820074] [0.06778421]
19 [-0.07263033] [0.06295579]
20 [-0.0674567] [0.0584713]
21 [-0.06265161] [0.05430625]
22 [-0.05818879] [0.0504379]
23 [-0.05404387] [0.04684509]
24 [-0.0501942] [0.04350821]
25 [-0.04661875] [0.04040902]
26 [-0.04329799] [0.03753059]
27 [-0.04021377] [0.0348572]
28 [-0.03734925] [0.03237424]
29 [-0.03468878] [0.03006815]
theta from own gd
[[3.66774691]
[3.25904489]]
0 [-0.07797763] [0.06079614]
1 [-0.07424587] [0.05788664]
2 [-0.06957317] [0.05424351]
3 [-0.06484181] [0.05055465]
4 [-0.06031928] [0.04702861]
5 [-0.05607583] [0.04372016]
6 [-0.05211919] [0.04063532]
7 [-0.04843794] [0.03776519]
8 [-0.04501548] [0.03509683]
9 [-0.04183444] [0.0326167]
10 [-0.03887807] [0.03031173]
11 [-0.03613058] [0.02816961]
12 [-0.03357723] [0.02617887]
13 [-0.03120433] [0.02432881]
14 [-0.02899912] [0.02260949]
15 [-0.02694975] [0.02101168]
16 [-0.02504521] [0.01952679]
17 [-0.02327527] [0.01814683]
18 [-0.0216304] [0.01686439]
19 [-0.02010178] [0.01567258]
20 [-0.01868119] [0.014565]
21 [-0.01736099] [0.01353569]
22 [-0.01613409] [0.01257912]
23 [-0.01499389] [0.01169016]
24 [-0.01393427] [0.01086401]
25 [-0.01294954] [0.01009625]
26 [-0.01203439] [0.00938275]
27 [-0.01118392] [0.00871967]
28 [-0.01039355] [0.00810345]
29 [-0.00965904] [0.00753078]
[[3.89378344]
[3.09206825]]
0 [-0.03221782] [0.02792633]
1 [-0.02992287] [0.02593707]
2 [-0.02710291] [0.02349274]
3 [-0.02432632] [0.02108599]
4 [-0.02176052] [0.01886197]
5 [-0.01944073] [0.01685118]
6 [-0.01735999] [0.01504759]
7 [-0.01549917] [0.01343464]
8 [-0.01383689] [0.01199378]
9 [-0.01235257] [0.01070717]
10 [-0.01102737] [0.0095585]
11 [-0.0098443] [0.00853302]
12 [-0.00878815] [0.00761755]
13 [-0.00784531] [0.00680029]
14 [-0.00700361] [0.00607072]
15 [-0.00625222] [0.00541941]
16 [-0.00558145] [0.00483798]
17 [-0.00498263] [0.00431893]
18 [-0.00444806] [0.00385557]
19 [-0.00397085] [0.00344192]
20 [-0.00354483] [0.00307265]
21 [-0.00316452] [0.002743]
22 [-0.00282501] [0.00244871]
23 [-0.00252192] [0.002186]
24 [-0.00225136] [0.00195147]
25 [-0.00200982] [0.0017421]
26 [-0.00179419] [0.0015552]
27 [-0.0016017] [0.00138835]
28 [-0.00142986] [0.0012394]
29 [-0.00127645] [0.00110643]
theta from own gd wth momentum
[[3.96175251]
[3.02982009]]
[[3.99624324]
[3.00325635]]
</pre></div>
</div>
</div>
@@ -1131,17 +1131,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.15451852]
[2.83230774]]
Eigenvalues of Hessian Matrix:[0.30616802 4.24299211]
0 [-10.57502449] [-11.57610367]
1 [-4.47905601e-15] [-4.07372439e-16]
2 [-6.9388939e-16] [-7.21432413e-16]
3 [-6.9388939e-16] [-7.21432413e-16]
4 [-6.9388939e-16] [-7.21432413e-16]
[[3.86346614]
[3.11457699]]
Eigenvalues of Hessian Matrix:[0.29561686 4.57324367]
0 [-14.07510754] [-17.31973052]
1 [1.77982629e-15] [1.66047885e-15]
2 [1.66533454e-16] [2.95162248e-16]
3 [1.66533454e-16] [2.95162248e-16]
4 [1.66533454e-16] [2.95162248e-16]
beta from own Newton code
[[4.15451852]
[2.83230774]]
[[3.86346614]
[3.11457699]]
</pre></div>
</div>
</div>
@@ -1230,20 +1230,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
[[4.04601419]
[3.12204312]]
Eigenvalues of Hessian Matrix:[0.33604208 4.45709724]
[[4.08540984]
[2.92466997]]
Eigenvalues of Hessian Matrix:[0.32128064 4.10407019]
theta from own gd
[[4.08540984]
[2.92466997]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
[[4.04601419]
[3.12204312]]
</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
[[4.02781444]
[3.13976073]]
[[4.02171224]
[2.94008244]]
</pre></div>
</div>
</div>
@@ -1325,15 +1323,17 @@ Eigenvalues of Hessian Matrix:[0.33604208 4.45709724]
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
[[3.96417888]
[3.06634473]]
Eigenvalues of Hessian Matrix:[0.32962444 4.18715465]
[[3.72066289]
[3.08799729]]
Eigenvalues of Hessian Matrix:[0.28726748 4.35313779]
theta from own gd
[[3.9639885]
[3.0665111]]
theta from own sdg with momentum
[[4.00842216]
[3.14285244]]
[[3.72055288]
[3.08809115]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg with momentum
[[3.72183526]
[3.12143852]]
</pre></div>
</div>
</div>
@@ -1408,9 +1408,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.99969895]
[3.00167058]
[3.99835872]]
[[2.00001365]
[2.99991971]
[4.00007964]]
</pre></div>
</div>
</div>
@@ -1492,9 +1492,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.99852187]
[3.03868311]
[3.95744254]]
[[2.00264795]
[3.00057362]
[3.99959681]]
</pre></div>
</div>
</div>
@@ -1580,9 +1580,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.99996471]
[3.00026784]
[3.99973141]]
[[1.99992477]
[3.00056337]
[3.99950283]]
</pre></div>
</div>
</div>
@@ -1655,7 +1655,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 0x11892e7f0&gt;]
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x1522ef130&gt;]
</pre></div>
</div>
<img alt="_images/exercisesweek41_39_2.png" src="_images/exercisesweek41_39_2.png" />
@@ -1690,7 +1690,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 0x118995f70&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.collections.PathCollection at 0x11c3bd700&gt;
</pre></div>
</div>
<img alt="_images/exercisesweek41_41_1.png" src="_images/exercisesweek41_41_1.png" />