update on notes
This commit is contained in:
@@ -338,6 +338,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises Week 42: Logistic Regression and Optimization, reminders from week 38 and week 40
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week43.html">
|
||||
Week 43: Deep Learning: Constructing a Neural Network code and solving differential equations
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -756,10 +761,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.044338305845698256
|
||||
4.255107903576545
|
||||
[[0.88333467 2.64297976]
|
||||
[2.64297976 8.95889379]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.1621766238509487
|
||||
3.735490390687699
|
||||
[[0.74336924 2.19036055]
|
||||
[2.19036055 7.50414881]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -799,10 +804,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.07412144024494684
|
||||
1.73876416607927
|
||||
[[1. 0.65003213]
|
||||
[0.65003213 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07865450504129884
|
||||
1.6463440100796987
|
||||
[[1. 0.63797452]
|
||||
[0.63797452 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -831,32 +836,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.30897153 -0.91624469]
|
||||
[-0.22194497 -0.77632217]
|
||||
[ 1.6025456 6.69899609]
|
||||
[-0.81040897 -2.22480853]
|
||||
[-1.11048466 -2.70090777]
|
||||
[-1.00173182 -4.12190193]
|
||||
[-0.28603828 -0.45183405]
|
||||
[ 0.90909173 2.29758118]
|
||||
[ 0.99446145 1.7129466 ]
|
||||
[ 0.23348144 0.48249527]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1
|
||||
0 -0.308972 -0.916245
|
||||
1 -0.221945 -0.776322
|
||||
2 1.602546 6.698996
|
||||
3 -0.810409 -2.224809
|
||||
4 -1.110485 -2.700908
|
||||
5 -1.001732 -4.121902
|
||||
6 -0.286038 -0.451834
|
||||
7 0.909092 2.297581
|
||||
8 0.994461 1.712947
|
||||
9 0.233481 0.482495
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.00615047 -0.51495078]
|
||||
[-1.23076025 -3.95226818]
|
||||
[ 0.14038959 1.1457534 ]
|
||||
[ 0.7408594 2.69734853]
|
||||
[ 0.19517373 1.18571046]
|
||||
[-0.04178558 -0.58598227]
|
||||
[ 0.45796224 0.7947491 ]
|
||||
[ 0.3351443 0.35268457]
|
||||
[ 0.04648472 0.35436034]
|
||||
[-0.63731768 -1.47740516]]
|
||||
0 1
|
||||
0 1.000000 0.957549
|
||||
1 0.957549 1.000000
|
||||
0 -0.006150 -0.514951
|
||||
1 -1.230760 -3.952268
|
||||
2 0.140390 1.145753
|
||||
3 0.740859 2.697349
|
||||
4 0.195174 1.185710
|
||||
5 -0.041786 -0.585982
|
||||
6 0.457962 0.794749
|
||||
7 0.335144 0.352685
|
||||
8 0.046485 0.354360
|
||||
9 -0.637318 -1.477405
|
||||
0 1
|
||||
0 1.000000 0.954148
|
||||
1 0.954148 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -913,37 +916,40 @@ 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.070975 0.074460 0.075880 0.075241 0.074296 0.070514 0.069132
|
||||
2 0.0 0.074460 0.078958 0.080631 0.080403 0.079783 0.075446 0.074283
|
||||
3 0.0 0.075880 0.080631 0.085807 0.085728 0.085268 0.082553 0.081410
|
||||
4 0.0 0.075241 0.080403 0.085728 0.085980 0.085820 0.082940 0.082057
|
||||
5 0.0 0.074296 0.079783 0.085268 0.085820 0.085937 0.082957 0.082318
|
||||
6 0.0 0.070514 0.075446 0.082553 0.082940 0.082957 0.081342 0.080608
|
||||
7 0.0 0.069132 0.074283 0.081410 0.082057 0.082318 0.080608 0.080103
|
||||
8 0.0 0.067779 0.073115 0.080268 0.081151 0.081637 0.079855 0.079562
|
||||
9 0.0 0.066483 0.071976 0.079161 0.080258 0.080950 0.079114 0.079017
|
||||
10 0.0 0.063682 0.068499 0.076361 0.077091 0.077476 0.076586 0.076225
|
||||
11 0.0 0.062352 0.067313 0.075129 0.076065 0.076647 0.075671 0.075501
|
||||
12 0.0 0.061118 0.066207 0.073985 0.075109 0.075872 0.074824 0.074830
|
||||
13 0.0 0.059979 0.065183 0.072932 0.074228 0.075157 0.074048 0.074216
|
||||
14 0.0 0.058935 0.064242 0.071969 0.073423 0.074506 0.073344 0.073662
|
||||
1 0.0 0.078267 0.080363 0.077060 0.080735 0.084346 0.068278 0.071704
|
||||
2 0.0 0.080363 0.084687 0.077184 0.081702 0.086410 0.067314 0.071070
|
||||
3 0.0 0.077060 0.077184 0.081107 0.083982 0.086548 0.074851 0.078039
|
||||
4 0.0 0.080735 0.081702 0.083982 0.087340 0.090475 0.076894 0.080380
|
||||
5 0.0 0.084346 0.086410 0.086548 0.090475 0.094304 0.078548 0.082355
|
||||
6 0.0 0.068278 0.067314 0.074851 0.076894 0.078548 0.071058 0.073683
|
||||
7 0.0 0.071704 0.071070 0.078039 0.080380 0.082355 0.073683 0.076547
|
||||
8 0.0 0.075284 0.075083 0.081283 0.083968 0.086326 0.076306 0.079429
|
||||
9 0.0 0.079000 0.079369 0.084535 0.087621 0.090437 0.078867 0.082274
|
||||
10 0.0 0.059805 0.058347 0.067435 0.068873 0.069916 0.065387 0.067507
|
||||
11 0.0 0.062733 0.061411 0.070367 0.072006 0.073253 0.067940 0.070248
|
||||
12 0.0 0.065842 0.064698 0.073442 0.075310 0.076791 0.070595 0.073109
|
||||
13 0.0 0.069136 0.068226 0.076654 0.078782 0.080535 0.073340 0.076079
|
||||
14 0.0 0.072615 0.072013 0.079987 0.082412 0.084486 0.076154 0.079138
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
1 0.067779 0.066483 0.063682 0.062352 0.061118 0.059979 0.058935
|
||||
2 0.073115 0.071976 0.068499 0.067313 0.066207 0.065183 0.064242
|
||||
3 0.080268 0.079161 0.076361 0.075129 0.073985 0.072932 0.071969
|
||||
4 0.081151 0.080258 0.077091 0.076065 0.075109 0.074228 0.073423
|
||||
5 0.081637 0.080950 0.077476 0.076647 0.075872 0.075157 0.074506
|
||||
6 0.079855 0.079114 0.076586 0.075671 0.074824 0.074048 0.073344
|
||||
7 0.079562 0.079017 0.076225 0.075501 0.074830 0.074216 0.073662
|
||||
8 0.079218 0.078855 0.075830 0.075284 0.074776 0.074314 0.073899
|
||||
9 0.078855 0.078661 0.075429 0.075048 0.074693 0.074372 0.074087
|
||||
10 0.075830 0.075429 0.073114 0.072518 0.071969 0.071471 0.071027
|
||||
11 0.075284 0.075048 0.072518 0.072085 0.071687 0.071328 0.071012
|
||||
12 0.074776 0.074693 0.071969 0.071687 0.071427 0.071197 0.071001
|
||||
13 0.074314 0.074372 0.071471 0.071328 0.071197 0.071087 0.071001
|
||||
14 0.073899 0.074087 0.071027 0.071012 0.071001 0.071001 0.071018
|
||||
1 0.075284 0.079000 0.059805 0.062733 0.065842 0.069136 0.072615
|
||||
2 0.075083 0.079369 0.058347 0.061411 0.064698 0.068226 0.072013
|
||||
3 0.081283 0.084535 0.067435 0.070367 0.073442 0.076654 0.079987
|
||||
4 0.083968 0.087621 0.068873 0.072006 0.075310 0.078782 0.082412
|
||||
5 0.086326 0.090437 0.069916 0.073253 0.076791 0.080535 0.084486
|
||||
6 0.076306 0.078867 0.065387 0.067940 0.070595 0.073340 0.076154
|
||||
7 0.079429 0.082274 0.067507 0.070248 0.073109 0.076079 0.079138
|
||||
8 0.082598 0.085762 0.069592 0.072533 0.075613 0.078825 0.082151
|
||||
9 0.085762 0.089288 0.071587 0.074738 0.078051 0.081523 0.085141
|
||||
10 0.069592 0.071587 0.061178 0.063336 0.065565 0.067851 0.070172
|
||||
11 0.072533 0.074738 0.063336 0.065655 0.068057 0.070529 0.073050
|
||||
12 0.075613 0.078051 0.065565 0.068057 0.070647 0.073320 0.076057
|
||||
13 0.078825 0.081523 0.067851 0.070529 0.073320 0.076212 0.079184
|
||||
14 0.082151 0.085141 0.070172 0.073050 0.076057 0.079184 0.082414
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1132,10 +1138,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.972024 1.967388
|
||||
1 1.967388 1.961423
|
||||
[[3.97202371 1.96738845]
|
||||
[1.96738845 1.96142343]]
|
||||
0 3.847343 1.919895
|
||||
1 1.919895 1.934339
|
||||
[[3.8473429 1.91989533]
|
||||
[1.91989533 1.934339 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1162,8 +1168,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.97202371 1.96738845]
|
||||
[1.96738845 1.96142343]]
|
||||
[[3.8473429 1.91989533]
|
||||
[1.91989533 1.934339 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
|
||||
@@ -1223,16 +1229,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.176077701534979
|
||||
0.7573694380469245
|
||||
5.035810431523915
|
||||
0.7458714725617228
|
||||
First eigenvector
|
||||
[0.85294194 0.52200578]
|
||||
[0.8502729 0.52634209]
|
||||
Second eigenvector
|
||||
[-0.52200578 0.85294194]
|
||||
[-0.52634209 0.8502729 ]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
|
||||
[-0.85294194 -0.52200578]
|
||||
[-0.8502729 -0.52634209]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1456,16 +1462,16 @@ training set, then extracts the first two principal components. First we center
|
||||
7 0.0 0.0 0.0 0.0 0.0
|
||||
8 0.0 0.0 0.0 0.0 0.0
|
||||
9 0.0 0.0 0.0 0.0 0.0
|
||||
[[-1.5378811 -0.94639099]
|
||||
[ 0.86145244 0.89288636]
|
||||
[-0.00445655 0.81633628]
|
||||
[ 0.07145103 -1.00433417]
|
||||
[ 2.03707133 -0.48476997]
|
||||
[ 0.72174172 -1.4557763 ]
|
||||
[-0.55854694 1.60673226]
|
||||
[ 1.6999536 0.43766686]
|
||||
[-1.10405456 0.31718909]
|
||||
[-2.18673098 -0.17953942]]
|
||||
[[-1.5378811 0.94639099]
|
||||
[ 0.86145244 -0.89288636]
|
||||
[-0.00445655 -0.81633628]
|
||||
[ 0.07145103 1.00433417]
|
||||
[ 2.03707133 0.48476997]
|
||||
[ 0.72174172 1.4557763 ]
|
||||
[-0.55854694 -1.60673226]
|
||||
[ 1.6999536 -0.43766686]
|
||||
[-1.10405456 -0.31718909]
|
||||
[-2.18673098 0.17953942]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user