small typos

This commit is contained in:
Morten Hjorth-Jensen
2022-09-08 14:44:41 +02:00
parent fa06cccfd8
commit c310894ae3
9 changed files with 1182 additions and 1182 deletions
+60 -60
View File
@@ -1204,10 +1204,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.08343519179767796
3.6669838269597004
[[ 1.09677394 3.55026099]
[ 3.55026099 12.59182949]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.030407120354722424
3.7843182645426894
[[ 1.22134069 3.4744219 ]
[ 3.4744219 10.84203538]]
</pre></div>
</div>
</div>
@@ -1244,10 +1244,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.07844310540708652
1.689230294669661
[[1. 0.69023787]
[0.69023787 1. ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.09023660662586945
1.5216048821598704
[[1. 0.62896882]
[0.62896882 1. ]]
</pre></div>
</div>
</div>
@@ -1277,30 +1277,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>[[ 1.79876149 5.76881337]
[-0.03184647 -0.35207264]
[ 0.02207532 -0.60802823]
[ 0.19096968 -0.0202458 ]
[ 0.18826299 -1.20664007]
[-1.23792491 -3.7873493 ]
[-0.07212695 0.3644017 ]
[-0.5554964 -1.02354476]
[-0.09252364 1.11231934]
[-0.2101511 -0.2476536 ]]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-1.30936179 -2.92208477]
[ 0.61757228 1.64238022]
[ 0.23816792 1.87666423]
[-0.45402701 -2.54845458]
[ 0.26848435 0.35074881]
[-0.92143477 -1.96473528]
[ 0.10516924 -0.36535019]
[ 0.70721787 3.41211579]
[ 0.75819326 1.03069324]
[-0.00998135 -0.51197747]]
0 1
0 1.798761 5.768813
1 -0.031846 -0.352073
2 0.022075 -0.608028
3 0.190970 -0.020246
4 0.188263 -1.206640
5 -1.237925 -3.787349
6 -0.072127 0.364402
7 -0.555496 -1.023545
8 -0.092524 1.112319
9 -0.210151 -0.247654
0 -1.309362 -2.922085
1 0.617572 1.642380
2 0.238168 1.876664
3 -0.454027 -2.548455
4 0.268484 0.350749
5 -0.921435 -1.964735
6 0.105169 -0.365350
7 0.707218 3.412116
8 0.758193 1.030693
9 -0.009981 -0.511977
0 1
0 1.000000 0.930683
1 0.930683 1.000000
0 1.000000 0.889686
1 0.889686 1.000000
</pre></div>
</div>
</div>
@@ -1357,37 +1357,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.093979 0.084151 0.094362 0.088519 0.082921 0.085936 0.081262
2 0.0 0.084151 0.076518 0.083152 0.078646 0.074346 0.075262 0.071569
3 0.0 0.094362 0.083152 0.100670 0.093844 0.087235 0.094848 0.089505
4 0.0 0.088519 0.078646 0.093844 0.087891 0.082122 0.088261 0.083573
5 0.0 0.082921 0.074346 0.087235 0.082122 0.077164 0.081848 0.077785
6 0.0 0.085936 0.075262 0.094848 0.088261 0.081848 0.091311 0.086178
7 0.0 0.081262 0.071569 0.089505 0.083573 0.077785 0.086178 0.081547
8 0.0 0.076905 0.068136 0.084476 0.079158 0.073959 0.081321 0.077158
9 0.0 0.072828 0.064937 0.079719 0.074980 0.070339 0.076697 0.072974
10 0.0 0.077359 0.067693 0.087224 0.081211 0.075335 0.085249 0.080555
11 0.0 0.073369 0.064483 0.082716 0.077228 0.071852 0.080922 0.076637
12 0.0 0.069667 0.061505 0.078508 0.073506 0.068593 0.076866 0.072958
13 0.0 0.066228 0.058740 0.074569 0.070018 0.065537 0.073052 0.069494
14 0.0 0.063024 0.056169 0.070871 0.066741 0.062665 0.069454 0.066220
1 0.0 0.092621 0.084912 0.094477 0.085405 0.077338 0.086802 0.078432
2 0.0 0.084912 0.079260 0.088946 0.081311 0.074401 0.083242 0.075899
3 0.0 0.094477 0.088946 0.102401 0.093930 0.086203 0.097710 0.089206
4 0.0 0.085405 0.081311 0.093930 0.086841 0.080288 0.090630 0.083300
5 0.0 0.077338 0.074401 0.086203 0.080288 0.074743 0.084032 0.077724
6 0.0 0.086802 0.083242 0.097710 0.090630 0.084032 0.095617 0.088029
7 0.0 0.078432 0.075899 0.089206 0.083300 0.077724 0.088029 0.081520
8 0.0 0.071086 0.069386 0.081637 0.076726 0.072021 0.081198 0.075618
9 0.0 0.064634 0.063612 0.074905 0.070835 0.066873 0.075058 0.070276
10 0.0 0.078704 0.076525 0.090849 0.085027 0.079495 0.090503 0.083913
11 0.0 0.071326 0.069907 0.083000 0.078157 0.073489 0.083251 0.077607
12 0.0 0.064859 0.064062 0.076055 0.072041 0.068110 0.076783 0.071949
13 0.0 0.059180 0.058890 0.069903 0.066590 0.063287 0.071009 0.066870
14 0.0 0.054182 0.054305 0.064442 0.061725 0.058957 0.065846 0.062305
8 9 10 11 12 13 14
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
1 0.076905 0.072828 0.077359 0.073369 0.069667 0.066228 0.063024
2 0.068136 0.064937 0.067693 0.064483 0.061505 0.058740 0.056169
3 0.084476 0.079719 0.087224 0.082716 0.078508 0.074569 0.070871
4 0.079158 0.074980 0.081211 0.077228 0.073506 0.070018 0.066741
5 0.073959 0.070339 0.075335 0.071852 0.068593 0.065537 0.062665
6 0.081321 0.076697 0.085249 0.080922 0.076866 0.073052 0.069454
7 0.077158 0.072974 0.080555 0.076637 0.072958 0.069494 0.066220
8 0.073206 0.069436 0.076096 0.072558 0.069231 0.066093 0.063125
9 0.069436 0.066056 0.071836 0.068654 0.065657 0.062827 0.060146
10 0.076096 0.071836 0.080502 0.076532 0.072798 0.069276 0.065942
11 0.072558 0.068654 0.076532 0.072898 0.069476 0.066241 0.063173
12 0.069231 0.065657 0.072798 0.069476 0.066340 0.063371 0.060550
13 0.066093 0.062827 0.069276 0.066241 0.063371 0.060649 0.058058
14 0.063125 0.060146 0.065942 0.063173 0.060550 0.058058 0.055684
1 0.071086 0.064634 0.078704 0.071326 0.064859 0.059180 0.054182
2 0.069386 0.063612 0.076525 0.069907 0.064062 0.058890 0.054305
3 0.081637 0.074905 0.090849 0.083000 0.076055 0.069903 0.064442
4 0.076726 0.070835 0.085027 0.078157 0.072041 0.066590 0.061725
5 0.072021 0.066873 0.079495 0.073489 0.068110 0.063287 0.058957
6 0.081198 0.075058 0.090503 0.083251 0.076783 0.071009 0.065846
7 0.075618 0.070276 0.083913 0.077607 0.071949 0.066870 0.062305
8 0.070518 0.065869 0.077921 0.072435 0.067484 0.063014 0.058974
9 0.065869 0.061821 0.072483 0.067710 0.063375 0.059437 0.055859
10 0.077921 0.072483 0.086809 0.080332 0.074513 0.069281 0.064573
11 0.072435 0.067710 0.080332 0.074708 0.069626 0.065032 0.060875
12 0.067484 0.063375 0.074513 0.069626 0.065183 0.061144 0.057469
13 0.063014 0.059437 0.069281 0.065032 0.061144 0.057588 0.054335
14 0.058974 0.055859 0.064573 0.060875 0.057469 0.054335 0.051451
</pre></div>
</div>
</div>
@@ -1611,7 +1611,7 @@ We have already analyzed the OLS solutions in terms of the eigenvectors (the col
\[
\tilde{\boldsymbol{y}}_{\mathrm{Ridge}}=\boldsymbol{X}\boldsymbol{\beta}_{\mathrm{Ridge}} = \boldsymbol{U\Sigma V^T}\left(\boldsymbol{V}\boldsymbol{\Sigma}^2\boldsymbol{V}^T+\lambda\boldsymbol{I} \right)^{-1}(\boldsymbol{U\Sigma V^T})^T\boldsymbol{y}=\sum_{j=0}^{p-1}\boldsymbol{u}_j\boldsymbol{u}_j^T\frac{\sigma_j^2}{\sigma_j^2+\lambda}\boldsymbol{y},
\]</div>
<p>with the vectors <span class="math notranslate nohighlight">\(\boldsymbol{u}_j\)</span> being the columns of <span class="math notranslate nohighlight">\(\boldsymbol{U}\)</span> from the SVD of the matrix <span class="math notranslate nohighlight">\(\boldsymbol{X}\)</span>. Note that the sums goes to <span class="math notranslate nohighlight">\(p-1\)</span> since, by definition, <span class="math notranslate nohighlight">\(\sigma_j=0\)</span> for <span class="math notranslate nohighlight">\(j &gt; p-1\)</span>.</p>
<p>with the vectors <span class="math notranslate nohighlight">\(\boldsymbol{u}_j\)</span> being the columns of <span class="math notranslate nohighlight">\(\boldsymbol{U}\)</span> from the SVD of the matrix <span class="math notranslate nohighlight">\(\boldsymbol{X}\)</span>. Note that the sums goes to <span class="math notranslate nohighlight">\(p-1\)</span> since.</p>
<p>Since <span class="math notranslate nohighlight">\(\lambda \geq 0\)</span>, it means that compared to OLS, we have</p>
<div class="math notranslate nohighlight">
\[
@@ -1631,7 +1631,7 @@ eigenvalues ordered in a descending way, that is <span class="math notranslate n
<p>In this case the standard OLS results in</p>
<div class="math notranslate nohighlight">
\[
\boldsymbol{\beta}^{\mathrm{OLS}} = \boldsymbol{X}^T\boldsymbol{y}=\sum_{i=0}^{n-1}\boldsymbol{u}_i\boldsymbol{u}_i^T\boldsymbol{y},
\boldsymbol{\beta}^{\mathrm{OLS}} = \boldsymbol{X}^T\boldsymbol{y}=\sum_{i=0}^{p-1}\boldsymbol{u}_i\boldsymbol{u}_i^T\boldsymbol{y},
\]</div>
<p>and</p>
<div class="math notranslate nohighlight">