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
+77 -70
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">
@@ -766,10 +771,10 @@ covariance matrix through the <strong>np.linalg.eig()</strong> function.</p>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.1255057631975562
3.579533981545493
[[0.80708107 2.37821193]
[2.37821193 8.11221557]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.0610096522011426
3.8847504075456363
[[ 1.07280604 3.11827698]
[ 3.11827698 10.20730033]]
</pre></div>
</div>
</div>
@@ -809,10 +814,10 @@ a more brute force way. Here we scale the mean values for each column of the des
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07588754093232836
1.3745699019323765
[[1. 0.60314576]
[0.60314576 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.08699604706693358
1.8785678201327416
[[1. 0.67701729]
[0.67701729 1. ]]
</pre></div>
</div>
</div>
@@ -841,30 +846,32 @@ this matrix we easily see that it is a positive definite matrix.</p>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-1.4664985 -5.74309684]
[ 0.4437291 1.90952533]
[ 1.55472805 4.78691713]
[-1.49928561 -4.52502695]
[ 1.17766528 3.5035492 ]
[-1.53311882 -4.84616248]
[ 0.58757487 2.2352456 ]
[-1.60585931 -5.88080569]
[ 1.30905952 3.50820404]
[ 1.03200542 5.05165065]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.56439048 -1.59243304]
[ 0.34744134 -0.79671424]
[-1.55842946 -5.7693748 ]
[ 0.1084649 0.43675706]
[-0.34689964 -0.80973749]
[ 0.54581307 1.66293202]
[-0.38075194 -0.87904563]
[ 0.89964122 5.25714271]
[ 0.67258465 1.91633883]
[ 0.27652633 0.57413459]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1
0 -0.564390 -1.592433
1 0.347441 -0.796714
2 -1.558429 -5.769375
3 0.108465 0.436757
4 -0.346900 -0.809737
5 0.545813 1.662932
6 -0.380752 -0.879046
7 0.899641 5.257143
8 0.672585 1.916339
9 0.276526 0.574135
0 1
0 -1.466499 -5.743097
1 0.443729 1.909525
2 1.554728 4.786917
3 -1.499286 -4.525027
4 1.177665 3.503549
5 -1.533119 -4.846162
6 0.587575 2.235246
7 -1.605859 -5.880806
8 1.309060 3.508204
9 1.032005 5.051651
0 1
0 1.000000 0.986472
1 0.986472 1.000000
0 1.000000 0.932605
1 0.932605 1.000000
</pre></div>
</div>
</div>
@@ -921,37 +928,37 @@ this matrix we easily see that it is a positive definite matrix.</p>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1 2 3 4 5 6 7 \
0 0.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.0 0.083504 0.075256 0.078921 0.075567 0.072065 0.068904 0.066579
2 0.0 0.075256 0.068613 0.070518 0.067902 0.065165 0.061508 0.059695
3 0.0 0.078921 0.070518 0.080620 0.076840 0.072951 0.073809 0.071199
4 0.0 0.075567 0.067902 0.076840 0.073512 0.070072 0.070294 0.068019
5 0.0 0.072065 0.065165 0.072951 0.070072 0.067082 0.066709 0.064764
6 0.0 0.068904 0.061508 0.073809 0.070294 0.066709 0.069698 0.067255
7 0.0 0.066579 0.059695 0.071199 0.068019 0.064764 0.067255 0.065071
8 0.0 0.064363 0.057976 0.068705 0.065848 0.062910 0.064922 0.062985
9 0.0 0.062226 0.056324 0.066296 0.063752 0.061123 0.062673 0.060974
10 0.0 0.059775 0.053480 0.066103 0.063023 0.059897 0.063806 0.061651
11 0.0 0.057936 0.052040 0.064062 0.061249 0.058385 0.061895 0.059951
12 0.0 0.056217 0.050702 0.062151 0.059593 0.056978 0.060108 0.058364
13 0.0 0.054609 0.049456 0.060358 0.058043 0.055668 0.058432 0.056880
14 0.0 0.053099 0.048295 0.058671 0.056590 0.054443 0.056857 0.055488
1 0.0 0.079059 0.081365 0.076315 0.081270 0.086391 0.066334 0.070891
2 0.0 0.081365 0.085489 0.076059 0.081793 0.087930 0.064777 0.069667
3 0.0 0.076315 0.076059 0.078398 0.082223 0.085871 0.071052 0.075199
4 0.0 0.081270 0.081793 0.082223 0.086686 0.091074 0.073735 0.078326
5 0.0 0.086391 0.087930 0.085871 0.091074 0.096339 0.076078 0.081151
6 0.0 0.066334 0.064777 0.071052 0.073735 0.076078 0.066329 0.069696
7 0.0 0.070891 0.069667 0.075199 0.078326 0.081151 0.069696 0.073438
8 0.0 0.075831 0.075047 0.079570 0.083213 0.086609 0.073167 0.077326
9 0.0 0.081169 0.080964 0.084139 0.088383 0.092454 0.076692 0.081316
10 0.0 0.057338 0.055249 0.063213 0.065107 0.066605 0.060295 0.063007
11 0.0 0.061147 0.059192 0.066951 0.069155 0.070974 0.063515 0.066524
12 0.0 0.065303 0.063532 0.070967 0.073529 0.075723 0.066934 0.070275
13 0.0 0.069840 0.068317 0.075276 0.078251 0.080886 0.070553 0.074265
14 0.0 0.074791 0.073599 0.079886 0.083341 0.086493 0.074366 0.078493
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.064363 0.062226 0.059775 0.057936 0.056217 0.054609 0.053099
2 0.057976 0.056324 0.053480 0.052040 0.050702 0.049456 0.048295
3 0.068705 0.066296 0.066103 0.064062 0.062151 0.060358 0.058671
4 0.065848 0.063752 0.063023 0.061249 0.059593 0.058043 0.056590
5 0.062910 0.061123 0.059897 0.058385 0.056978 0.055668 0.054443
6 0.064922 0.062673 0.063806 0.061895 0.060108 0.058432 0.056857
7 0.062985 0.060974 0.061651 0.059951 0.058364 0.056880 0.055488
8 0.061136 0.059355 0.059595 0.058098 0.056703 0.055402 0.054185
9 0.059355 0.057796 0.057619 0.056315 0.055105 0.053981 0.052934
10 0.059595 0.057619 0.059363 0.057675 0.056097 0.054621 0.053236
11 0.058098 0.056315 0.057675 0.056161 0.054750 0.053432 0.052199
12 0.056703 0.055105 0.056097 0.054750 0.053497 0.052330 0.051241
13 0.055402 0.053981 0.054621 0.053432 0.052330 0.051307 0.050356
14 0.054185 0.052934 0.053236 0.052199 0.051241 0.050356 0.049538
1 0.075831 0.081169 0.057338 0.061147 0.065303 0.069840 0.074791
2 0.075047 0.080964 0.055249 0.059192 0.063532 0.068317 0.073599
3 0.079570 0.084139 0.063213 0.066951 0.070967 0.075276 0.079886
4 0.083213 0.088383 0.065107 0.069155 0.073529 0.078251 0.083341
5 0.086609 0.092454 0.066605 0.070974 0.075723 0.080886 0.086493
6 0.073167 0.076692 0.060295 0.063515 0.066934 0.070553 0.074366
7 0.077326 0.081316 0.063007 0.066524 0.070275 0.074265 0.078493
8 0.081683 0.086203 0.065751 0.069590 0.073705 0.078104 0.082794
9 0.086203 0.091326 0.068471 0.072660 0.077172 0.082023 0.087227
10 0.065751 0.068471 0.055720 0.058436 0.061294 0.064287 0.067400
11 0.069590 0.072660 0.058436 0.061405 0.064542 0.067841 0.071290
12 0.073705 0.077172 0.061294 0.064542 0.067986 0.071624 0.075448
13 0.078104 0.082023 0.064287 0.067841 0.071624 0.075640 0.079883
14 0.082794 0.087227 0.067400 0.071290 0.075448 0.079883 0.084595
</pre></div>
</div>
</div>
@@ -1140,10 +1147,10 @@ We can write our own code or simply use either the functionaly of <strong>numpy<
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1
0 3.969573 1.988769
1 1.988769 2.007390
[[3.96957289 1.98876882]
[1.98876882 2.00738983]]
0 4.021032 1.990843
1 1.990843 1.969959
[[4.02103235 1.99084335]
[1.99084335 1.9699594 ]]
</pre></div>
</div>
</div>
@@ -1170,8 +1177,8 @@ Our own code here is not very elegant and asks for obvious improvements. It is t
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Centered covariance using own code
[[3.96957289 1.98876882]
[1.98876882 2.00738983]]
[[4.02103235 1.99084335]
[1.99084335 1.9699594 ]]
</pre></div>
</div>
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
@@ -1231,16 +1238,16 @@ questions.</p>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Covariance matrix
5.206079615468402
0.7708831044105582
5.234956145890017
0.7560356057040467
First eigenvector
[0.84923841 0.52800959]
[0.85379714 0.52060584]
Second eigenvector
[-0.52800959 0.84923841]
[-0.52060584 0.85379714]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
[-0.84923841 -0.52800959]
[-0.85379714 -0.52060584]
</pre></div>
</div>
</div>