This commit is contained in:
Morten Hjorth-Jensen
2023-08-31 06:19:44 +02:00
parent e9bac09427
commit d05f791ff6
98 changed files with 3861 additions and 2496 deletions
+86 -59
View File
@@ -242,6 +242,33 @@ const thebe_selector_output = ".output, .cell_output"
</a>
</li>
</ul>
<p aria-level="2" class="caption" role="heading">
<span class="caption-text">
Weekly material, notes and exercises
</span>
</p>
<ul class="nav bd-sidenav">
<li class="toctree-l1">
<a class="reference internal" href="exercisesweek34.html">
Exercises week 34
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week34.html">
Week 34: Introduction to the course, Logistics and Practicalities
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="exercisesweek35.html">
Exercises week 35
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week35.html">
Week 35: From Ordinary Linear Regression to Ridge and Lasso Regression
</a>
</li>
</ul>
</div>
</nav> <!-- To handle the deprecated key -->
@@ -1206,10 +1233,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.08873443359350565
3.7851533175757255
[[ 0.98248312 3.05483267]
[ 3.05483267 10.24784064]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.008947823579448178
4.14822021080294
[[0.73947737 2.16006961]
[2.16006961 7.24782786]]
</pre></div>
</div>
</div>
@@ -1246,10 +1273,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.07858099596662704
2.071920625289855
[[1. 0.71822416]
[0.71822416 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.08657894597048958
2.219222942590059
[[1. 0.6343356]
[0.6343356 1. ]]
</pre></div>
</div>
</div>
@@ -1279,30 +1306,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>[[ -2.84861838 -10.07337358]
[ 0.53938383 2.59445979]
[ -0.40980089 -0.48871288]
[ 0.05834332 -0.39384255]
[ 2.25385387 7.58112299]
[ 0.68246434 2.46650488]
[ -0.25366775 -1.97047717]
[ 0.79081838 2.03807267]
[ -0.06150169 -0.57109235]
[ -0.75127504 -1.18266178]]
0 1
0 -2.848618 -10.073374
1 0.539384 2.594460
2 -0.409801 -0.488713
3 0.058343 -0.393843
4 2.253854 7.581123
5 0.682464 2.466505
6 -0.253668 -1.970477
7 0.790818 2.038073
8 -0.061502 -0.571092
9 -0.751275 -1.182662
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[ 0.29724806 0.26804287]
[-0.15626984 -1.36853738]
[-0.77070756 -2.13536532]
[-0.45372697 -3.1582408 ]
[ 0.52580392 2.72567956]
[-0.86515815 -1.35704388]
[-0.73738602 -2.12933164]
[-0.10486183 1.06292011]
[ 1.75670484 5.27381733]
[ 0.50835355 0.81805914]]
0 1
0 1.000000 0.984525
1 0.984525 1.000000
0 0.297248 0.268043
1 -0.156270 -1.368537
2 -0.770708 -2.135365
3 -0.453727 -3.158241
4 0.525804 2.725680
5 -0.865158 -1.357044
6 -0.737386 -2.129332
7 -0.104862 1.062920
8 1.756705 5.273817
9 0.508354 0.818059
0 1
0 1.000000 0.915549
1 0.915549 1.000000
</pre></div>
</div>
</div>
@@ -1359,37 +1386,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.090241 0.082140 0.090564 0.084086 0.078082 0.082282 0.076619
2 0.0 0.082140 0.075227 0.083102 0.077428 0.072150 0.075982 0.070945
3 0.0 0.090564 0.083102 0.096893 0.090268 0.084107 0.091647 0.085571
4 0.0 0.084086 0.077428 0.090268 0.084286 0.078707 0.085655 0.080120
5 0.0 0.078082 0.072150 0.084107 0.078707 0.073657 0.080061 0.075020
6 0.0 0.082282 0.075982 0.091647 0.085655 0.080061 0.089082 0.083380
7 0.0 0.076619 0.070945 0.085571 0.080120 0.075020 0.083380 0.078158
8 0.0 0.071394 0.066284 0.079944 0.074984 0.070333 0.078082 0.073299
9 0.0 0.066569 0.061966 0.074729 0.070216 0.065973 0.073159 0.068776
10 0.0 0.073831 0.068541 0.084523 0.079224 0.074258 0.083779 0.078587
11 0.0 0.068867 0.064081 0.079021 0.074183 0.069640 0.078484 0.073716
12 0.0 0.064284 0.059952 0.073925 0.069506 0.065349 0.073567 0.069187
13 0.0 0.060048 0.056127 0.069202 0.065165 0.061359 0.068999 0.064974
14 0.0 0.056131 0.052581 0.064823 0.061133 0.057648 0.064753 0.061054
1 0.0 0.086925 0.087377 0.087520 0.087878 0.088164 0.079680 0.079580
2 0.0 0.087377 0.089240 0.088074 0.089063 0.089924 0.079827 0.080060
3 0.0 0.087520 0.088074 0.094227 0.094252 0.094139 0.089441 0.088974
4 0.0 0.087878 0.089063 0.094252 0.094610 0.094812 0.089040 0.088778
5 0.0 0.088164 0.089924 0.094139 0.094812 0.095315 0.088488 0.088425
6 0.0 0.079680 0.079827 0.089441 0.089040 0.088488 0.087315 0.086524
7 0.0 0.079580 0.080060 0.088974 0.088778 0.088425 0.086524 0.085876
8 0.0 0.079499 0.080295 0.088502 0.088506 0.088348 0.085716 0.085210
9 0.0 0.079448 0.080548 0.088037 0.088238 0.088275 0.084906 0.084541
10 0.0 0.071751 0.071438 0.082839 0.082089 0.081194 0.082509 0.081481
11 0.0 0.071392 0.071284 0.082139 0.081533 0.080780 0.081559 0.080641
12 0.0 0.071071 0.071164 0.081471 0.081007 0.080395 0.080635 0.079827
13 0.0 0.070794 0.071084 0.080839 0.080518 0.080048 0.079741 0.079043
14 0.0 0.070562 0.071051 0.080249 0.080070 0.079745 0.078880 0.078293
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.071394 0.066569 0.073831 0.068867 0.064284 0.060048 0.056131
2 0.066284 0.061966 0.068541 0.064081 0.059952 0.056127 0.052581
3 0.079944 0.074729 0.084523 0.079021 0.073925 0.069202 0.064823
4 0.074984 0.070216 0.079224 0.074183 0.069506 0.065165 0.061133
5 0.070333 0.065973 0.074258 0.069640 0.065349 0.061359 0.057648
6 0.078082 0.073159 0.083779 0.078484 0.073567 0.068999 0.064753
7 0.073299 0.068776 0.078587 0.073716 0.069187 0.064974 0.061054
8 0.068841 0.064684 0.073750 0.069268 0.065095 0.061209 0.057588
9 0.064684 0.060863 0.069242 0.065118 0.061272 0.057686 0.054340
10 0.073750 0.069242 0.079948 0.075028 0.070450 0.066189 0.062220
11 0.069268 0.065118 0.075028 0.070494 0.066270 0.062333 0.058663
12 0.065095 0.061272 0.070450 0.066270 0.062370 0.058732 0.055337
13 0.061209 0.057686 0.066189 0.062333 0.058732 0.055369 0.052227
14 0.057588 0.054340 0.062220 0.058663 0.055337 0.052227 0.049318
1 0.079499 0.079448 0.071751 0.071392 0.071071 0.070794 0.070562
2 0.080295 0.080548 0.071438 0.071284 0.071164 0.071084 0.071051
3 0.088502 0.088037 0.082839 0.082139 0.081471 0.080839 0.080249
4 0.088506 0.088238 0.082089 0.081533 0.081007 0.080518 0.080070
5 0.088348 0.088275 0.081194 0.080780 0.080395 0.080048 0.079745
6 0.085716 0.084906 0.082509 0.081559 0.080635 0.079741 0.078880
7 0.085210 0.084541 0.081481 0.080641 0.079827 0.079043 0.078293
8 0.084685 0.084157 0.080434 0.079704 0.078999 0.078326 0.077688
9 0.084157 0.083772 0.079379 0.078759 0.078165 0.077604 0.077079
10 0.080434 0.079379 0.079152 0.078033 0.076935 0.075863 0.074818
11 0.079704 0.078759 0.078033 0.077004 0.075996 0.075014 0.074061
12 0.078999 0.078165 0.076935 0.075996 0.075079 0.074187 0.073325
13 0.078326 0.077604 0.075863 0.075014 0.074187 0.073388 0.072618
14 0.077688 0.077079 0.074818 0.074061 0.073325 0.072618 0.071942
</pre></div>
</div>
</div>