update
This commit is contained in:
@@ -257,6 +257,9 @@
|
||||
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: From Decision Trees to Ensemble Methods, Random Forests and Boosting Methods</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47</a></li>
|
||||
|
||||
<li class="toctree-l1"><a class="reference internal" href="week48.html">Week 48: Gradient boosting and summary of course</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="exercisesweek48.html">Exercises week 48</a></li>
|
||||
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
|
||||
<ul class="nav bd-sidenav">
|
||||
@@ -617,10 +620,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.08913527419249101
|
||||
3.7127415072708665
|
||||
[[ 1.13025431 3.39215451]
|
||||
[ 3.39215451 11.15061293]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.02745698767039481
|
||||
3.9527157086177156
|
||||
[[0.80249705 2.35440603]
|
||||
[2.35440603 7.83541057]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -660,10 +663,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.09335279187105122
|
||||
2.2108106787032815
|
||||
[[1. 0.66771869]
|
||||
[0.66771869 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07408022521552643
|
||||
1.9519435372439522
|
||||
[[1. 0.56323995]
|
||||
[0.56323995 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -692,30 +695,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.35582913 0.96196912]
|
||||
[ 0.20039135 1.07902642]
|
||||
[-0.47708415 -1.39752266]
|
||||
[-0.0118395 0.55664957]
|
||||
[-0.18990703 1.30646904]
|
||||
[ 0.22370063 -0.76173777]
|
||||
[-0.25925579 -1.7132548 ]
|
||||
[-0.56061802 -1.9921751 ]
|
||||
[-1.14025916 -4.44655399]
|
||||
[ 1.85904253 6.40713017]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[ 0.53340467 1.72530188]
|
||||
[-0.56167889 -3.2544002 ]
|
||||
[ 1.85988539 5.87145508]
|
||||
[-1.23561281 -4.57354138]
|
||||
[ 0.52739566 0.93489572]
|
||||
[ 0.89775088 2.87036267]
|
||||
[-0.71834014 -0.65667853]
|
||||
[ 0.38699758 1.30537358]
|
||||
[-1.48772565 -3.9664681 ]
|
||||
[-0.20207669 -0.25630072]]
|
||||
0 1
|
||||
0 0.355829 0.961969
|
||||
1 0.200391 1.079026
|
||||
2 -0.477084 -1.397523
|
||||
3 -0.011839 0.556650
|
||||
4 -0.189907 1.306469
|
||||
5 0.223701 -0.761738
|
||||
6 -0.259256 -1.713255
|
||||
7 -0.560618 -1.992175
|
||||
8 -1.140259 -4.446554
|
||||
9 1.859043 6.407130
|
||||
0 0.533405 1.725302
|
||||
1 -0.561679 -3.254400
|
||||
2 1.859885 5.871455
|
||||
3 -1.235613 -4.573541
|
||||
4 0.527396 0.934896
|
||||
5 0.897751 2.870363
|
||||
6 -0.718340 -0.656679
|
||||
7 0.386998 1.305374
|
||||
8 -1.487726 -3.966468
|
||||
9 -0.202077 -0.256301
|
||||
0 1
|
||||
0 1.000000 0.946278
|
||||
1 0.946278 1.000000
|
||||
0 1.000000 0.966262
|
||||
1 0.966262 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -772,37 +775,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.075894 0.073179 0.073456 0.072746 0.071970 0.064485 0.064123
|
||||
2 0.0 0.073179 0.070833 0.070597 0.070031 0.069409 0.061930 0.061649
|
||||
3 0.0 0.073456 0.070597 0.076555 0.075647 0.074674 0.070295 0.069812
|
||||
4 0.0 0.072746 0.070031 0.075647 0.074821 0.073930 0.069398 0.068968
|
||||
5 0.0 0.071970 0.069409 0.074674 0.073930 0.073126 0.068445 0.068069
|
||||
6 0.0 0.064485 0.061930 0.070295 0.069398 0.068445 0.066551 0.066050
|
||||
7 0.0 0.064123 0.061649 0.069812 0.068968 0.068069 0.066050 0.065589
|
||||
8 0.0 0.063763 0.061372 0.069330 0.068539 0.067694 0.065550 0.065128
|
||||
9 0.0 0.063403 0.061097 0.068844 0.068107 0.067318 0.065047 0.064664
|
||||
10 0.0 0.055942 0.053732 0.062913 0.062085 0.061210 0.060946 0.060463
|
||||
11 0.0 0.055680 0.053525 0.062569 0.061780 0.060945 0.060582 0.060130
|
||||
12 0.0 0.055429 0.053330 0.062237 0.061487 0.060692 0.060229 0.059808
|
||||
13 0.0 0.055190 0.053147 0.061915 0.061205 0.060449 0.059887 0.059497
|
||||
14 0.0 0.054960 0.052974 0.061603 0.060933 0.060217 0.059554 0.059195
|
||||
1 0.0 0.073438 0.077471 0.075458 0.076186 0.076594 0.069080 0.068939
|
||||
2 0.0 0.077471 0.083242 0.080919 0.082408 0.083412 0.074516 0.074729
|
||||
3 0.0 0.075458 0.080919 0.083069 0.084410 0.085279 0.079308 0.079408
|
||||
4 0.0 0.076186 0.082408 0.084410 0.086139 0.087327 0.080792 0.081105
|
||||
5 0.0 0.076594 0.083412 0.085279 0.087327 0.088786 0.081792 0.082290
|
||||
6 0.0 0.069080 0.074516 0.079308 0.080792 0.081792 0.077847 0.078070
|
||||
7 0.0 0.068939 0.074729 0.079408 0.081105 0.082290 0.078070 0.078429
|
||||
8 0.0 0.068716 0.074791 0.079363 0.081242 0.082589 0.078134 0.078618
|
||||
9 0.0 0.068441 0.074753 0.079219 0.081258 0.082750 0.078091 0.078687
|
||||
10 0.0 0.061939 0.066921 0.073159 0.074603 0.075599 0.073240 0.073520
|
||||
11 0.0 0.061580 0.066741 0.072883 0.074456 0.075571 0.073054 0.073431
|
||||
12 0.0 0.061213 0.066524 0.072574 0.074264 0.075487 0.072829 0.073296
|
||||
13 0.0 0.060849 0.066290 0.072252 0.074047 0.075371 0.072584 0.073135
|
||||
14 0.0 0.060497 0.066053 0.071930 0.073822 0.075239 0.072334 0.072965
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
1 0.063763 0.063403 0.055942 0.055680 0.055429 0.055190 0.054960
|
||||
2 0.061372 0.061097 0.053732 0.053525 0.053330 0.053147 0.052974
|
||||
3 0.069330 0.068844 0.062913 0.062569 0.062237 0.061915 0.061603
|
||||
4 0.068539 0.068107 0.062085 0.061780 0.061487 0.061205 0.060933
|
||||
5 0.067694 0.067318 0.061210 0.060945 0.060692 0.060449 0.060217
|
||||
6 0.065550 0.065047 0.060946 0.060582 0.060229 0.059887 0.059554
|
||||
7 0.065128 0.064664 0.060463 0.060130 0.059808 0.059497 0.059195
|
||||
8 0.064706 0.064282 0.059981 0.059679 0.059388 0.059108 0.058837
|
||||
9 0.064282 0.063898 0.059497 0.059226 0.058967 0.058718 0.058478
|
||||
10 0.059981 0.059497 0.056837 0.056475 0.056124 0.055783 0.055452
|
||||
11 0.059679 0.059226 0.056475 0.056139 0.055814 0.055499 0.055194
|
||||
12 0.059388 0.058967 0.056124 0.055814 0.055515 0.055226 0.054947
|
||||
13 0.059108 0.058718 0.055783 0.055499 0.055226 0.054963 0.054709
|
||||
14 0.058837 0.058478 0.055452 0.055194 0.054947 0.054709 0.054481
|
||||
1 0.068716 0.068441 0.061939 0.061580 0.061213 0.060849 0.060497
|
||||
2 0.074791 0.074753 0.066921 0.066741 0.066524 0.066290 0.066053
|
||||
3 0.079363 0.079219 0.073159 0.072883 0.072574 0.072252 0.071930
|
||||
4 0.081242 0.081258 0.074603 0.074456 0.074264 0.074047 0.073822
|
||||
5 0.082589 0.082750 0.075599 0.075571 0.075487 0.075371 0.075239
|
||||
6 0.078134 0.078091 0.073240 0.073054 0.072829 0.072584 0.072334
|
||||
7 0.078618 0.078687 0.073520 0.073431 0.073296 0.073135 0.072965
|
||||
8 0.078919 0.079094 0.073650 0.073652 0.073602 0.073523 0.073430
|
||||
9 0.079094 0.079368 0.073677 0.073765 0.073796 0.073795 0.073777
|
||||
10 0.073650 0.073677 0.069911 0.069801 0.069653 0.069484 0.069308
|
||||
11 0.073652 0.073765 0.069801 0.069768 0.069692 0.069593 0.069484
|
||||
12 0.073602 0.073796 0.069653 0.069692 0.069686 0.069654 0.069611
|
||||
13 0.073523 0.073795 0.069484 0.069593 0.069654 0.069688 0.069709
|
||||
14 0.073430 0.073777 0.069308 0.069484 0.069611 0.069709 0.069791
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -991,10 +994,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.946263 1.971035
|
||||
1 1.971035 1.988524
|
||||
[[3.94626291 1.97103474]
|
||||
[1.97103474 1.98852413]]
|
||||
0 4.066103 2.050297
|
||||
1 2.050297 2.019626
|
||||
[[4.06610301 2.0502966 ]
|
||||
[2.0502966 2.01962561]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1021,11 +1024,11 @@ 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.94626291 1.97103474]
|
||||
[1.97103474 1.98852413]]
|
||||
[[4.06610301 2.0502966 ]
|
||||
[2.0502966 2.01962561]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/6ca0e6a8c6122c37cbb752b49917fd1e67a1de46298e8c2247a990d083fdb3c7.png" src="_images/6ca0e6a8c6122c37cbb752b49917fd1e67a1de46298e8c2247a990d083fdb3c7.png" />
|
||||
<img alt="_images/6221ee55bb26dba5cef5540ef9967df02eb119abda11c5c5903f7762c8c9f763.png" src="_images/6221ee55bb26dba5cef5540ef9967df02eb119abda11c5c5903f7762c8c9f763.png" />
|
||||
</div>
|
||||
</div>
|
||||
<p>Depending on the number of points <span class="math notranslate nohighlight">\(n\)</span>, we will get results that are close to the covariance values defined above.
|
||||
@@ -1082,16 +1085,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.168112312789667
|
||||
0.7666747242371026
|
||||
5.3343122336302145
|
||||
0.7514163800957537
|
||||
First eigenvector
|
||||
[0.84993979 0.52687982]
|
||||
[0.85045481 0.5260481 ]
|
||||
Second eigenvector
|
||||
[-0.52687982 0.84993979]
|
||||
[-0.5260481 0.85045481]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
|
||||
[0.84993979 0.52687982]
|
||||
[0.85045481 0.5260481 ]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user