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
+45 -25
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">
@@ -1641,7 +1651,7 @@ Since we are not using <strong>Scikit-Learn</strong> here we can define our own
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9969513794144311
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9952505213910134
</pre></div>
</div>
</div>
@@ -1658,7 +1668,7 @@ Since we are not using <strong>Scikit-Learn</strong> here we can define our own
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.007658477904313023
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.008753288788081405
</pre></div>
</div>
</div>
@@ -1673,23 +1683,31 @@ Since we are not using <strong>Scikit-Learn</strong> here we can define our own
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.00053122 0.03115122 0.00789262 0.02218076 0.00573727 0.00557893
0.00099778 0.01234 0.03960002 0.03596557 0.0134113 0.00556946
0.00136125 0.10719554 0.02754248 0.01409478 0.01760144 0.01032533
0.01241284 0.01039879 0.00100913 0.02944152 0.00512599 0.00747773
0.06260611 0.0231353 0.01624447 0.02923006 0.0046544 0.07332248
0.02338085 0.02920675 0.02286267 0.04353549 0.00569512 0.02664408
0.01098247 0.02156565 0.03529801 0.00507531 0.00554202 0.05141614
0.02031987 0.01244297 0.01551724 0.00174738 0.01044475 0.01161645
0.02622039 0.03285784 0.00522055 0.00687309 0.0195302 0.04101344
0.00816675 0.0206033 0.04046513 0.02189863 0.06777772 0.04832356
0.00114855 0.08660891 0.00586355 0.00625051 0.00939407 0.00108471
0.03948301 0.02527621 0.03205795 0.11042239 0.02594314 0.05176711
0.03396658 0.00889475 0.02632742 0.02502325 0.01266999 0.00455966
0.03853313 0.01543076 0.00617221 0.00552462 0.01573062 0.01035006
0.00162921 0.00974758 0.00812487 0.01881237 0.06690071 0.01499192
0.04652794 0.04061345 0.04495752 0.00566707 0.01006984 0.00519717
0.00151416 0.03214829 0.00891702 0.01844822]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[8.90304177e-02 3.21655059e-02 1.15924557e-02 1.83823317e-02
8.19559737e-03 1.66018725e-02 1.79135536e-03 1.03313259e-01
7.69182892e-04 1.29306584e-02 1.21565007e-02 2.83463634e-03
3.03538673e-02 2.37415625e-02 1.56790195e-02 9.03400724e-03
1.35613536e-02 5.35506347e-02 1.01123792e-02 4.10604579e-02
2.63898112e-02 1.94766419e-02 3.81425129e-02 3.27482829e-02
5.12829994e-03 6.02901273e-03 8.26321660e-02 4.04504728e-02
2.20601797e-02 4.62113349e-03 9.03476611e-04 4.87494456e-02
3.82060913e-03 2.53729411e-02 2.38612299e-02 1.59355752e-02
3.60160003e-03 1.65738717e-02 2.98947674e-02 5.18501900e-03
9.36303682e-03 4.81218742e-02 1.49392067e-02 4.88551766e-03
2.17643975e-02 2.20608548e-04 1.90135464e-02 2.74291603e-02
1.23344210e-02 6.03309191e-03 1.57252451e-02 9.02612988e-03
3.32084559e-02 3.76692036e-03 2.87169607e-02 4.85551266e-02
1.48826894e-02 6.41842093e-04 1.89017198e-02 3.49584063e-02
1.77652198e-02 6.38298234e-03 1.05034088e-03 1.99753321e-02
5.52031552e-03 8.22217237e-03 6.86192682e-02 8.40354798e-03
1.29491144e-02 7.44658658e-03 1.00731392e-02 9.52284329e-02
1.51437058e-02 2.00002585e-05 2.37700967e-02 1.95166920e-02
4.82376174e-02 3.73986200e-02 4.84707251e-02 8.76887316e-02
2.74724414e-02 5.14825560e-03 1.26254957e-02 2.81042619e-02
2.11265643e-02 2.52301447e-03 3.13819592e-02 2.93900569e-02
3.65720152e-02 1.02850506e-02 4.85945208e-02 2.79870689e-02
3.12846660e-02 6.17869861e-02 9.09590269e-03 1.11715109e-02
3.62863106e-02 1.21277816e-02 9.05665429e-03 4.85293303e-02]
</pre></div>
</div>
</div>
@@ -1758,15 +1776,15 @@ but now splitting the data into a training set and a test set.</p>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 1.97243946 0.15593478 4.54011398 0.56342158 -0.19299283]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 2.05054319 -0.48521055 6.95338273 -2.63619709 1.0524497 ]
Training R2
0.9948998579029953
0.9959308805732706
Training MSE
0.009396472959497925
0.009211602191395454
Test R2
0.9951059931014423
0.9955318336036834
Test MSE
0.010612904886352397
0.011818646101922625
</pre></div>
</div>
</div>
@@ -2430,7 +2448,9 @@ the aims is to reproduce Figure 2.11 of <a class="reference external" href="http
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>MSE before scaling: 0.00
R2 score before scaling 1.00
Feature min values before scaling:
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Feature min values before scaling:
[1.00000000e+00 6.97906022e-03 2.43639284e-03 4.87072815e-05
1.70037324e-05 5.93601008e-06 3.39931051e-07 1.18670072e-07
4.14277718e-08 1.44624525e-08 2.37239927e-09 8.28205578e-10