This commit is contained in:
Morten Hjorth-Jensen
2024-09-22 21:21:59 +02:00
parent 0a6ba7c08d
commit 80f0f2ffab
102 changed files with 18315 additions and 2027 deletions
+72 -60
View File
@@ -298,6 +298,16 @@ const thebe_selector_output = ".output, .cell_output"
Week 38: Logistic Regression and Optimization
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="exercisesweek39.html">
Exercises week 39
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week39.html">
Week 39: Optimization and Gradient Methods
</a>
</li>
</ul>
<p aria-level="2" class="caption" role="heading">
<span class="caption-text">
@@ -1275,10 +1285,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.07978850553011713
3.8232102961414203
[[ 1.25705685 3.70704566]
[ 3.70704566 12.1664372 ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.024792624800382218
3.9225384545636204
[[0.94623184 2.84401886]
[2.84401886 9.4477214 ]]
</pre></div>
</div>
</div>
@@ -1315,10 +1325,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.08931169286872433
2.047447724189861
[[1. 0.66729685]
[0.66729685 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.08536248571780691
1.8207274870895702
[[1. 0.74900488]
[0.74900488 1. ]]
</pre></div>
</div>
</div>
@@ -1348,30 +1358,32 @@ 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.37582891 5.4242743 ]
[-0.81925302 -3.60052901]
[ 0.37467515 3.16158074]
[-0.40478305 -2.22601408]
[-0.0776532 -1.70594608]
[-0.99434472 -2.2026985 ]
[ 0.71376303 2.77725472]
[ 0.94637206 2.69303453]
[-0.19791352 0.93366198]
[-1.91669165 -5.2546186 ]]
0 1
0 2.375829 5.424274
1 -0.819253 -3.600529
2 0.374675 3.161581
3 -0.404783 -2.226014
4 -0.077653 -1.705946
5 -0.994345 -2.202698
6 0.713763 2.777255
7 0.946372 2.693035
8 -0.197914 0.933662
9 -1.916692 -5.254619
0 1
0 1.000000 0.932382
1 0.932382 1.000000
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[ 1.10115017 1.66431407]
[ 0.12043521 1.32305911]
[-1.30023144 -3.36154104]
[-0.25200841 -1.11277166]
[-1.55102329 -4.20158083]
[ 0.72770687 0.97206657]
[ 0.76533281 2.10747579]
[-0.20666447 0.79623487]
[-0.63919355 -2.48490503]
[ 1.23449607 4.29764815]]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1
0 1.101150 1.664314
1 0.120435 1.323059
2 -1.300231 -3.361541
3 -0.252008 -1.112772
4 -1.551023 -4.201581
5 0.727707 0.972067
6 0.765333 2.107476
7 -0.206664 0.796235
8 -0.639194 -2.484905
9 1.234496 4.297648
0 1
0 1.0000 0.9434
1 0.9434 1.0000
</pre></div>
</div>
</div>
@@ -1428,37 +1440,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.080947 0.086913 0.082764 0.085436 0.088029 0.075956 0.077683
2 0.0 0.086913 0.094044 0.088199 0.091365 0.094439 0.080171 0.082174
3 0.0 0.082764 0.088199 0.090624 0.093094 0.095465 0.086730 0.088375
4 0.0 0.085436 0.091365 0.093094 0.095805 0.098414 0.088651 0.090440
5 0.0 0.088029 0.094439 0.095465 0.098414 0.101263 0.090468 0.092401
6 0.0 0.075956 0.080171 0.086730 0.088651 0.090468 0.085390 0.086712
7 0.0 0.077683 0.082174 0.088375 0.090440 0.092401 0.086712 0.088127
8 0.0 0.079444 0.084218 0.090038 0.092252 0.094362 0.088038 0.089548
9 0.0 0.081252 0.086318 0.091731 0.094099 0.096365 0.089376 0.090985
10 0.0 0.068684 0.071868 0.080702 0.082126 0.083446 0.081103 0.082115
11 0.0 0.069978 0.073339 0.081978 0.083499 0.084915 0.082170 0.083248
12 0.0 0.071314 0.074859 0.083288 0.084910 0.086428 0.083260 0.084406
13 0.0 0.072697 0.076435 0.084637 0.086364 0.087988 0.084376 0.085592
14 0.0 0.074130 0.078071 0.086026 0.087864 0.089600 0.085518 0.086809
1 0.0 0.083179 0.086483 0.081217 0.083548 0.086239 0.072037 0.073514
2 0.0 0.086483 0.091362 0.082533 0.085853 0.089626 0.071638 0.073800
3 0.0 0.081217 0.082533 0.084963 0.086068 0.087429 0.079030 0.079670
4 0.0 0.083548 0.085853 0.086068 0.087871 0.089996 0.078945 0.080094
5 0.0 0.086239 0.089626 0.087429 0.089996 0.092956 0.079002 0.080706
6 0.0 0.072037 0.071638 0.079030 0.078945 0.079002 0.076071 0.075876
7 0.0 0.073514 0.073800 0.079670 0.080094 0.080706 0.075876 0.076066
8 0.0 0.075289 0.076321 0.080549 0.081527 0.082742 0.075842 0.076448
9 0.0 0.077391 0.079240 0.081686 0.083268 0.085145 0.075978 0.077035
10 0.0 0.063786 0.062216 0.072380 0.071437 0.070552 0.071436 0.070622
11 0.0 0.064606 0.063536 0.072591 0.072031 0.071560 0.071049 0.070531
12 0.0 0.065654 0.065121 0.072997 0.072849 0.072826 0.070805 0.070605
13 0.0 0.066948 0.067000 0.073612 0.073911 0.074374 0.070712 0.070855
14 0.0 0.068512 0.069203 0.074454 0.075239 0.076232 0.070780 0.071294
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.079444 0.081252 0.068684 0.069978 0.071314 0.072697 0.074130
2 0.084218 0.086318 0.071868 0.073339 0.074859 0.076435 0.078071
3 0.090038 0.091731 0.080702 0.081978 0.083288 0.084637 0.086026
4 0.092252 0.094099 0.082126 0.083499 0.084910 0.086364 0.087864
5 0.094362 0.096365 0.083446 0.084915 0.086428 0.087988 0.089600
6 0.088038 0.089376 0.081103 0.082170 0.083260 0.084376 0.085518
7 0.089548 0.090985 0.082115 0.083248 0.084406 0.085592 0.086809
8 0.091068 0.092607 0.083119 0.084319 0.085548 0.086808 0.088102
9 0.092607 0.094254 0.084122 0.085392 0.086694 0.088030 0.089404
10 0.083119 0.084122 0.078238 0.079089 0.079953 0.080832 0.081728
11 0.084319 0.085392 0.079089 0.079989 0.080903 0.081835 0.082785
12 0.085548 0.086694 0.079953 0.080903 0.081871 0.082857 0.083864
13 0.086808 0.088030 0.080832 0.081835 0.082857 0.083900 0.084967
14 0.088102 0.089404 0.081728 0.082785 0.083864 0.084967 0.086096
1 0.075289 0.077391 0.063786 0.064606 0.065654 0.066948 0.068512
2 0.076321 0.079240 0.062216 0.063536 0.065121 0.067000 0.069203
3 0.080549 0.081686 0.072380 0.072591 0.072997 0.073612 0.074454
4 0.081527 0.083268 0.071437 0.072031 0.072849 0.073911 0.075239
5 0.082742 0.085145 0.070552 0.071560 0.072826 0.074374 0.076232
6 0.075842 0.075978 0.071436 0.071049 0.070805 0.070712 0.070780
7 0.076448 0.077035 0.070622 0.070531 0.070605 0.070855 0.071294
8 0.077280 0.078359 0.069907 0.070135 0.070552 0.071173 0.072015
9 0.078359 0.079976 0.069293 0.069866 0.070655 0.071680 0.072961
10 0.069907 0.069293 0.068353 0.067515 0.066778 0.066145 0.065619
11 0.070135 0.069866 0.067515 0.066912 0.066425 0.066059 0.065821
12 0.070552 0.070655 0.066778 0.066425 0.066205 0.066127 0.066199
13 0.071173 0.071680 0.066145 0.066059 0.066127 0.066358 0.066766
14 0.072015 0.072961 0.065619 0.065821 0.066199 0.066766 0.067539
</pre></div>
</div>
</div>