This commit is contained in:
Morten Hjorth-Jensen
2023-11-08 15:57:33 +01:00
parent 2edd177646
commit 3b9f0dbb29
145 changed files with 3873 additions and 2256 deletions
+79 -69
View File
@@ -343,6 +343,16 @@ const thebe_selector_output = ".output, .cell_output"
Week 43: Deep Learning: Constructing a Neural Network code and solving differential equations
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week44.html">
Week 44, Convolutional Neural Networks (CNN)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week45.html">
Week 45, Recurrent Neural Networks
</a>
</li>
</ul>
<p aria-level="2" class="caption" role="heading">
<span class="caption-text">
@@ -761,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.04570437990371566
4.420442688206847
[[ 1.01597952 3.06059304]
[ 3.06059304 10.1387933 ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.11743722141098414
3.5452708224046345
[[ 1.27880068 3.85600299]
[ 3.85600299 12.61955303]]
</pre></div>
</div>
</div>
@@ -804,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.07663067400487368
1.9423652864980914
[[1. 0.72782592]
[0.72782592 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07178264457746288
1.6714298027296224
[[1. 0.59987612]
[0.59987612 1. ]]
</pre></div>
</div>
</div>
@@ -836,30 +846,30 @@ 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>[[-0.51761523 -1.42486342]
[ 1.91816586 6.87585634]
[-0.34694145 -1.09920915]
[ 0.31244861 1.08282867]
[ 1.12441319 3.24411906]
[-0.51892347 -1.08417181]
[-0.54509921 -2.1148557 ]
[ 0.26084008 0.60846694]
[ 0.01029574 0.21049575]
[-1.69758412 -6.29866668]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-1.05589275 -2.32845846]
[-1.43650129 -5.0020496 ]
[ 0.30685269 -0.25002882]
[ 1.1511986 3.95940231]
[-0.84931504 -2.84538739]
[-0.63401971 -1.90876452]
[ 0.39256409 1.76775004]
[ 1.07828283 3.52988562]
[-0.18753987 0.14133772]
[ 1.23437046 2.9363131 ]]
0 1
0 -0.517615 -1.424863
1 1.918166 6.875856
2 -0.346941 -1.099209
3 0.312449 1.082829
4 1.124413 3.244119
5 -0.518923 -1.084172
6 -0.545099 -2.114856
7 0.260840 0.608467
8 0.010296 0.210496
9 -1.697584 -6.298667
0 -1.055893 -2.328458
1 -1.436501 -5.002050
2 0.306853 -0.250029
3 1.151199 3.959402
4 -0.849315 -2.845387
5 -0.634020 -1.908765
6 0.392564 1.767750
7 1.078283 3.529886
8 -0.187540 0.141338
9 1.234370 2.936313
0 1
0 1.000000 0.993148
1 0.993148 1.000000
0 1.000000 0.972745
1 0.972745 1.000000
</pre></div>
</div>
</div>
@@ -916,37 +926,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.079243 0.085251 0.080541 0.083416 0.086394 0.074010 0.075867
2 0.0 0.085251 0.093570 0.084995 0.089008 0.093218 0.076658 0.079150
3 0.0 0.080541 0.084995 0.088240 0.090361 0.092452 0.084878 0.086337
4 0.0 0.083416 0.089008 0.090361 0.093080 0.095821 0.086090 0.087899
5 0.0 0.086394 0.093218 0.092452 0.095821 0.099275 0.087175 0.089365
6 0.0 0.074010 0.076658 0.084878 0.086090 0.087175 0.084042 0.084968
7 0.0 0.075867 0.079150 0.086337 0.087899 0.089365 0.084968 0.086108
8 0.0 0.077847 0.081832 0.087845 0.089793 0.091685 0.085877 0.087254
9 0.0 0.079975 0.084740 0.089414 0.091796 0.094163 0.086774 0.088416
10 0.0 0.067272 0.068624 0.079437 0.079971 0.080322 0.080193 0.080702
11 0.0 0.068609 0.070338 0.080572 0.081322 0.081908 0.081000 0.081647
12 0.0 0.070043 0.072194 0.081762 0.082754 0.083604 0.081821 0.082621
13 0.0 0.071587 0.074211 0.083015 0.084278 0.085427 0.082657 0.083630
14 0.0 0.073256 0.076413 0.084340 0.085908 0.087393 0.083511 0.084678
1 0.0 0.093993 0.092566 0.095420 0.093559 0.091714 0.087802 0.086054
2 0.0 0.092566 0.091571 0.094206 0.092560 0.090919 0.086830 0.085223
3 0.0 0.095420 0.094206 0.103273 0.101409 0.099552 0.098879 0.097049
4 0.0 0.093559 0.092560 0.101409 0.099701 0.097995 0.097238 0.095528
5 0.0 0.091714 0.090919 0.099552 0.097995 0.096434 0.095596 0.094001
6 0.0 0.087802 0.086830 0.098879 0.097238 0.095596 0.097294 0.095624
7 0.0 0.086054 0.085223 0.097049 0.095528 0.094001 0.095624 0.094050
8 0.0 0.084365 0.083669 0.095273 0.093866 0.092450 0.093996 0.092516
9 0.0 0.082734 0.082168 0.093551 0.092254 0.090945 0.092412 0.091021
10 0.0 0.079914 0.079165 0.092493 0.091090 0.089678 0.092852 0.091372
11 0.0 0.078377 0.077731 0.090832 0.089523 0.088202 0.091293 0.089893
12 0.0 0.076897 0.076349 0.089227 0.088007 0.086773 0.089781 0.088456
13 0.0 0.075471 0.075017 0.087674 0.086540 0.085390 0.088314 0.087062
14 0.0 0.074096 0.073734 0.086172 0.085121 0.084051 0.086891 0.085709
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.077847 0.079975 0.067272 0.068609 0.070043 0.071587 0.073256
2 0.081832 0.084740 0.068624 0.070338 0.072194 0.074211 0.076413
3 0.087845 0.089414 0.079437 0.080572 0.081762 0.083015 0.084340
4 0.089793 0.091796 0.079971 0.081322 0.082754 0.084278 0.085908
5 0.091685 0.094163 0.080322 0.081908 0.083604 0.085427 0.087393
6 0.085877 0.086774 0.080193 0.081000 0.081821 0.082657 0.083511
7 0.087254 0.088416 0.080702 0.081647 0.082621 0.083630 0.084678
8 0.088665 0.090123 0.081150 0.082248 0.083393 0.084594 0.085858
9 0.090123 0.091913 0.081538 0.082805 0.084141 0.085557 0.087063
10 0.081150 0.081538 0.077571 0.078106 0.078624 0.079125 0.079606
11 0.082248 0.082805 0.078106 0.078732 0.079353 0.079969 0.080577
12 0.083393 0.084141 0.078624 0.079353 0.080089 0.080832 0.081584
13 0.084594 0.085557 0.079125 0.079969 0.080832 0.081718 0.082632
14 0.085858 0.087063 0.079606 0.080577 0.081584 0.082632 0.083726
1 0.084365 0.082734 0.079914 0.078377 0.076897 0.075471 0.074096
2 0.083669 0.082168 0.079165 0.077731 0.076349 0.075017 0.073734
3 0.095273 0.093551 0.092493 0.090832 0.089227 0.087674 0.086172
4 0.093866 0.092254 0.091090 0.089523 0.088007 0.086540 0.085121
5 0.092450 0.090945 0.089678 0.088202 0.086773 0.085390 0.084051
6 0.093996 0.092412 0.092852 0.091293 0.089781 0.088314 0.086891
7 0.092516 0.091021 0.091372 0.089893 0.088456 0.087062 0.085709
8 0.091072 0.089664 0.089925 0.088521 0.087159 0.085835 0.084550
9 0.089664 0.088339 0.088510 0.087180 0.085888 0.084633 0.083414
10 0.089925 0.088510 0.089979 0.088563 0.087184 0.085842 0.084536
11 0.088521 0.087180 0.088563 0.087212 0.085898 0.084617 0.083371
12 0.087159 0.085888 0.087184 0.085898 0.084644 0.083423 0.082234
13 0.085835 0.084633 0.085842 0.084617 0.083423 0.082260 0.081126
14 0.084550 0.083414 0.084536 0.083371 0.082234 0.081126 0.080045
</pre></div>
</div>
</div>
@@ -1135,10 +1145,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.987648 2.034723
1 2.034723 2.038727
[[3.98764765 2.03472297]
[2.03472297 2.03872663]]
0 4.068439 2.030371
1 2.030371 2.006046
[[4.06843936 2.03037095]
[2.03037095 2.00604596]]
</pre></div>
</div>
</div>
@@ -1165,8 +1175,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.98764765 2.03472297]
[2.03472297 2.03872663]]
[[4.06843936 2.03037095]
[2.03037095 2.00604596]]
</pre></div>
</div>
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
@@ -1226,16 +1236,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.269217029290255
0.7571572558830478
5.314471861842257
0.7600134536106469
First eigenvector
[0.84614892 0.53294653]
[0.8522997 0.52305374]
Second eigenvector
[-0.53294653 0.84614892]
[-0.52305374 0.8522997 ]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
[-0.84614892 -0.53294653]
[0.8522997 0.52305374]
</pre></div>
</div>
</div>