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
+69 -71
View File
@@ -751,10 +751,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.1001408041761458
4.2807716628772665
[[ 1.15654145 3.54867722]
[ 3.54867722 11.70485195]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.05665875086534638
4.128393685824704
[[ 0.93987367 2.98650457]
[ 2.98650457 10.47544463]]
</pre></div>
</div>
</div>
@@ -794,10 +794,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.09543871010617433
1.6888043337746685
[[1. 0.7167077]
[0.7167077 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07617734331359052
1.6957182489166325
[[1. 0.68029423]
[0.68029423 1. ]]
</pre></div>
</div>
</div>
@@ -826,30 +826,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.20575734 0.01384583]
[-0.89876098 -3.04065686]
[-0.76289128 -3.17080691]
[-0.0334136 0.16124569]
[ 2.73970542 9.28885103]
[ 0.75413023 2.98474769]
[-1.87894459 -5.48121459]
[-1.26814205 -2.4848097 ]
[ 0.18114057 -0.9889962 ]
[ 1.37293361 2.71779401]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.29087396 0.13244119]
[-1.21617146 -2.69678073]
[-1.37024276 -3.76728511]
[ 0.49342785 1.50638863]
[ 0.4155974 -0.07435812]
[ 0.64813145 1.94455739]
[-0.48364163 -2.62178739]
[-0.3807176 -1.25007671]
[ 1.73036439 5.00709577]
[ 0.45412633 1.81980509]]
0 1
0 -0.205757 0.013846
1 -0.898761 -3.040657
2 -0.762891 -3.170807
3 -0.033414 0.161246
4 2.739705 9.288851
5 0.754130 2.984748
6 -1.878945 -5.481215
7 -1.268142 -2.484810
8 0.181141 -0.988996
9 1.372934 2.717794
0 -0.290874 0.132441
1 -1.216171 -2.696781
2 -1.370243 -3.767285
3 0.493428 1.506389
4 0.415597 -0.074358
5 0.648131 1.944557
6 -0.483642 -2.621787
7 -0.380718 -1.250077
8 1.730364 5.007096
9 0.454126 1.819805
0 1
0 1.000000 0.970965
1 0.970965 1.000000
0 1.000000 0.961042
1 0.961042 1.000000
</pre></div>
</div>
</div>
@@ -906,37 +906,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.090565 0.089065 0.093226 0.091674 0.090154 0.086287 0.084847
2 0.0 0.089065 0.087946 0.092421 0.091068 0.089735 0.085988 0.084674
3 0.0 0.093226 0.092421 0.102147 0.100816 0.099494 0.098144 0.096731
4 0.0 0.091674 0.091068 0.100816 0.099622 0.098431 0.097115 0.095803
5 0.0 0.090154 0.089735 0.099494 0.098431 0.097365 0.096077 0.094862
6 0.0 0.086287 0.085988 0.098144 0.097115 0.096077 0.096630 0.095395
7 0.0 0.084847 0.084674 0.096731 0.095803 0.094862 0.095395 0.094243
8 0.0 0.083459 0.083405 0.095358 0.094527 0.093680 0.094189 0.093115
9 0.0 0.082121 0.082180 0.094027 0.093288 0.092530 0.093011 0.092013
10 0.0 0.078708 0.078711 0.091732 0.090935 0.090118 0.091871 0.090804
11 0.0 0.077431 0.077523 0.090387 0.089668 0.088926 0.090626 0.089626
12 0.0 0.076203 0.076378 0.089086 0.088441 0.087772 0.089417 0.088481
13 0.0 0.075021 0.075274 0.087828 0.087255 0.086655 0.088242 0.087369
14 0.0 0.073883 0.074212 0.086611 0.086107 0.085573 0.087102 0.086289
1 0.0 0.068131 0.073423 0.069509 0.072262 0.074935 0.062568 0.064540
2 0.0 0.073423 0.079638 0.075544 0.078741 0.081836 0.068222 0.070480
3 0.0 0.069509 0.075544 0.075689 0.079013 0.082264 0.070991 0.073416
4 0.0 0.072262 0.078741 0.079013 0.082596 0.086101 0.074265 0.076876
5 0.0 0.074935 0.081836 0.082264 0.086101 0.089859 0.077488 0.080287
6 0.0 0.062568 0.068222 0.070991 0.074265 0.077488 0.068479 0.070924
7 0.0 0.064540 0.070480 0.073416 0.076876 0.080287 0.070924 0.073514
8 0.0 0.066545 0.072773 0.075883 0.079535 0.083138 0.073418 0.076157
9 0.0 0.068597 0.075114 0.078409 0.082256 0.086058 0.075974 0.078867
10 0.0 0.055105 0.060160 0.064322 0.067367 0.070380 0.063327 0.065650
11 0.0 0.056730 0.062004 0.066330 0.069526 0.072694 0.065375 0.067819
12 0.0 0.058409 0.063910 0.068406 0.071759 0.075086 0.067492 0.070063
13 0.0 0.060149 0.065884 0.070556 0.074073 0.077566 0.069686 0.072388
14 0.0 0.061956 0.067932 0.072787 0.076473 0.080139 0.071962 0.074802
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.083459 0.082121 0.078708 0.077431 0.076203 0.075021 0.073883
2 0.083405 0.082180 0.078711 0.077523 0.076378 0.075274 0.074212
3 0.095358 0.094027 0.091732 0.090387 0.089086 0.087828 0.086611
4 0.094527 0.093288 0.090935 0.089668 0.088441 0.087255 0.086107
5 0.093680 0.092530 0.090118 0.088926 0.087772 0.086655 0.085573
6 0.094189 0.093011 0.091871 0.090626 0.089417 0.088242 0.087102
7 0.093115 0.092013 0.090804 0.089626 0.088481 0.087369 0.086289
8 0.092064 0.091034 0.089755 0.088642 0.087560 0.086508 0.085486
9 0.091034 0.090075 0.088726 0.087675 0.086653 0.085659 0.084694
10 0.089755 0.088726 0.088455 0.087327 0.086227 0.085155 0.084112
11 0.088642 0.087675 0.087327 0.086256 0.085212 0.084195 0.083203
12 0.087560 0.086653 0.086227 0.085212 0.084222 0.083257 0.082316
13 0.086508 0.085659 0.085155 0.084195 0.083257 0.082342 0.081450
14 0.085486 0.084694 0.084112 0.083203 0.082316 0.081450 0.080605
1 0.066545 0.068597 0.055105 0.056730 0.058409 0.060149 0.061956
2 0.072773 0.075114 0.060160 0.062004 0.063910 0.065884 0.067932
3 0.075883 0.078409 0.064322 0.066330 0.068406 0.070556 0.072787
4 0.079535 0.082256 0.067367 0.069526 0.071759 0.074073 0.076473
5 0.083138 0.086058 0.070380 0.072694 0.075086 0.077566 0.080139
6 0.073418 0.075974 0.063327 0.065375 0.067492 0.069686 0.071962
7 0.076157 0.078867 0.065650 0.067819 0.070063 0.072388 0.074802
8 0.078953 0.081823 0.068024 0.070318 0.072693 0.075155 0.077711
9 0.081823 0.084858 0.070460 0.072885 0.075396 0.078000 0.080704
10 0.068024 0.070460 0.059480 0.061447 0.063482 0.065591 0.067780
11 0.070318 0.072885 0.061447 0.063517 0.065661 0.067883 0.070190
12 0.072693 0.075396 0.063482 0.065661 0.067917 0.070258 0.072688
13 0.075155 0.078000 0.065591 0.067883 0.070258 0.072721 0.075281
14 0.077711 0.080704 0.067780 0.070190 0.072688 0.075281 0.077975
</pre></div>
</div>
</div>
@@ -1125,12 +1125,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 4.114499 2.071143
1 2.071143 2.061388
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[4.11449851 2.07114326]
[2.07114326 2.0613875 ]]
0 4.060824 2.038890
1 2.038890 2.029664
[[4.06082419 2.03888998]
[2.03888998 2.02966421]]
</pre></div>
</div>
</div>
@@ -1157,8 +1155,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
[[4.11449851 2.07114326]
[2.07114326 2.0613875 ]]
[[4.06082419 2.03888998]
[2.03888998 2.02966421]]
</pre></div>
</div>
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
@@ -1218,16 +1216,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.399533503407795
0.776352510835556
5.323066643161066
0.7674217625964539
First eigenvector
[0.84973247 0.52721412]
[0.85025162 0.52637646]
Second eigenvector
[-0.52721412 0.84973247]
[-0.52637646 0.85025162]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
[-0.84973247 -0.52721412]
[-0.85025162 -0.52637646]
</pre></div>
</div>
</div>