updated book

This commit is contained in:
Morten Hjorth-Jensen
2024-09-11 05:36:59 +02:00
parent 19a064b629
commit 3b762e5606
42 changed files with 580 additions and 524 deletions
+69 -69
View File
@@ -706,10 +706,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.1477190177681485
3.5426270409877345
[[1.01393496 3.02432309]
[3.02432309 9.86643649]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.10541723644166373
4.575870409023631
[[0.84972787 2.5321613 ]
[2.5321613 8.59875207]]
</pre></div>
</div>
</div>
@@ -749,10 +749,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.08793554992813543
1.9271707090281667
[[1. 0.6690108]
[0.6690108 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.0768805855280187
1.6568154596723088
[[1. 0.69438869]
[0.69438869 1. ]]
</pre></div>
</div>
</div>
@@ -781,30 +781,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.95395895 -3.11535632]
[ 1.05641352 3.6533977 ]
[ 0.801356 4.56475921]
[-0.69136414 -1.7642448 ]
[ 0.68822559 0.63896182]
[ 0.30916988 1.25233253]
[ 0.10008326 0.10539984]
[-0.52155823 -1.85777073]
[ 0.24377554 0.94616709]
[-1.03214247 -4.42364634]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-1.6629598 -6.60625144]
[-1.59424119 -4.17676247]
[ 0.13699574 -1.26680052]
[ 1.67275915 7.04206048]
[ 1.48931464 4.73718419]
[ 0.82341746 3.16411163]
[ 0.56141009 1.13137881]
[ 0.38616125 0.98338288]
[-1.28000355 -3.69734609]
[-0.53285379 -1.31095745]]
0 1
0 -0.953959 -3.115356
1 1.056414 3.653398
2 0.801356 4.564759
3 -0.691364 -1.764245
4 0.688226 0.638962
5 0.309170 1.252333
6 0.100083 0.105400
7 -0.521558 -1.857771
8 0.243776 0.946167
9 -1.032142 -4.423646
0 -1.662960 -6.606251
1 -1.594241 -4.176762
2 0.136996 -1.266801
3 1.672759 7.042060
4 1.489315 4.737184
5 0.823417 3.164112
6 0.561410 1.131379
7 0.386161 0.983383
8 -1.280004 -3.697346
9 -0.532854 -1.310957
0 1
0 1.000000 0.947607
1 0.947607 1.000000
0 1.000000 0.972149
1 0.972149 1.000000
</pre></div>
</div>
</div>
@@ -861,37 +861,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.079977 0.079947 0.079510 0.081431 0.083259 0.070891 0.072689
2 0.0 0.079947 0.081195 0.081235 0.083734 0.086125 0.073415 0.075557
3 0.0 0.079510 0.081235 0.084255 0.086970 0.089578 0.078324 0.080630
4 0.0 0.081431 0.083734 0.086970 0.090033 0.092982 0.081221 0.083765
5 0.0 0.083259 0.086125 0.089578 0.092982 0.096270 0.084018 0.086799
6 0.0 0.070891 0.073415 0.078324 0.081221 0.084018 0.074971 0.077341
7 0.0 0.072689 0.075557 0.080630 0.083765 0.086799 0.077341 0.079887
8 0.0 0.074531 0.077736 0.082971 0.086346 0.089619 0.079739 0.082464
9 0.0 0.076418 0.079959 0.085353 0.088970 0.092486 0.082173 0.085079
10 0.0 0.062300 0.065028 0.070886 0.073685 0.076396 0.069322 0.071578
11 0.0 0.063862 0.066824 0.072817 0.075794 0.078684 0.071279 0.073672
12 0.0 0.065482 0.068680 0.074807 0.077965 0.081038 0.073288 0.075822
13 0.0 0.067164 0.070600 0.076859 0.080205 0.083465 0.075356 0.078035
14 0.0 0.068912 0.072590 0.078981 0.082519 0.085973 0.077486 0.080316
1 0.0 0.083793 0.077516 0.081955 0.073791 0.066763 0.071803 0.064695
2 0.0 0.077516 0.074112 0.078363 0.072304 0.066838 0.070556 0.064873
3 0.0 0.081955 0.078363 0.084619 0.077941 0.071937 0.076833 0.070462
4 0.0 0.073791 0.072304 0.077941 0.073102 0.068533 0.072132 0.067141
5 0.0 0.066763 0.066838 0.071937 0.068533 0.065108 0.067671 0.063791
6 0.0 0.071803 0.070556 0.076833 0.072132 0.067671 0.071608 0.066653
7 0.0 0.064695 0.064873 0.070462 0.067141 0.063791 0.066653 0.062797
8 0.0 0.058641 0.059876 0.064878 0.062637 0.060171 0.062173 0.059201
9 0.0 0.053462 0.055477 0.059977 0.058582 0.056826 0.058133 0.055876
10 0.0 0.061862 0.062199 0.067948 0.064820 0.061637 0.064615 0.060898
11 0.0 0.056026 0.057316 0.062429 0.060312 0.057964 0.060087 0.057216
12 0.0 0.051042 0.053036 0.057609 0.056287 0.054609 0.056041 0.053854
13 0.0 0.046764 0.049276 0.053387 0.052692 0.051554 0.052427 0.050796
14 0.0 0.043072 0.045963 0.049677 0.049481 0.048781 0.049196 0.048020
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.074531 0.076418 0.062300 0.063862 0.065482 0.067164 0.068912
2 0.077736 0.079959 0.065028 0.066824 0.068680 0.070600 0.072590
3 0.082971 0.085353 0.070886 0.072817 0.074807 0.076859 0.078981
4 0.086346 0.088970 0.073685 0.075794 0.077965 0.080205 0.082519
5 0.089619 0.092486 0.076396 0.078684 0.081038 0.083465 0.085973
6 0.079739 0.082173 0.069322 0.071279 0.073288 0.075356 0.077486
7 0.082464 0.085079 0.071578 0.073672 0.075822 0.078035 0.080316
8 0.085222 0.088023 0.073858 0.076091 0.078386 0.080747 0.083182
9 0.088023 0.091015 0.076167 0.078544 0.080987 0.083501 0.086095
10 0.073858 0.076167 0.065149 0.067003 0.068903 0.070855 0.072863
11 0.076091 0.078544 0.067003 0.068967 0.070980 0.073048 0.075177
12 0.078386 0.080987 0.068903 0.070980 0.073109 0.075298 0.077553
13 0.080747 0.083501 0.070855 0.073048 0.075298 0.077613 0.079998
14 0.083182 0.086095 0.072863 0.075177 0.077553 0.079998 0.082518
1 0.058641 0.053462 0.061862 0.056026 0.051042 0.046764 0.043072
2 0.059876 0.055477 0.062199 0.057316 0.053036 0.049276 0.045963
3 0.064878 0.059977 0.067948 0.062429 0.057609 0.053387 0.049677
4 0.062637 0.058582 0.064820 0.060312 0.056287 0.052692 0.049481
5 0.060171 0.056826 0.061637 0.057964 0.054609 0.051554 0.048781
6 0.062173 0.058133 0.064615 0.060087 0.056041 0.052427 0.049196
7 0.059201 0.055876 0.060898 0.057216 0.053854 0.050796 0.048020
8 0.056328 0.053599 0.057420 0.054434 0.051645 0.049060 0.046678
9 0.053599 0.051368 0.054197 0.051787 0.049479 0.047299 0.045258
10 0.057420 0.054197 0.059243 0.055653 0.052370 0.049380 0.046663
11 0.054434 0.051787 0.055653 0.052738 0.050015 0.047489 0.045161
12 0.051645 0.049479 0.052370 0.050015 0.047760 0.045630 0.043637
13 0.049060 0.047299 0.049380 0.047489 0.045630 0.043839 0.042136
14 0.046678 0.045258 0.046663 0.045161 0.043637 0.042136 0.040684
</pre></div>
</div>
</div>
@@ -1080,10 +1080,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.970827 1.972533
1 1.972533 1.968650
[[3.97082748 1.97253307]
[1.97253307 1.96865004]]
0 3.986362 1.994474
1 1.994474 2.001468
[[3.98636199 1.99447418]
[1.99447418 2.00146807]]
</pre></div>
</div>
</div>
@@ -1110,8 +1110,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.97082748 1.97253307]
[1.97253307 1.96865004]]
[[3.98636199 1.99447418]
[1.99447418 2.00146807]]
</pre></div>
</div>
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
@@ -1171,16 +1171,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.181766185664273
0.7577113351177733
5.221666864828611
0.766163196245293
First eigenvector
[0.85222243 0.52317963]
[0.85014487 0.52654886]
Second eigenvector
[-0.52317963 0.85222243]
[-0.52654886 0.85014487]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
[0.85222243 0.52317963]
[-0.85014487 -0.52654886]
</pre></div>
</div>
</div>