update on jupyter-book
This commit is contained in:
@@ -293,6 +293,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 38
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week38.html">
|
||||
Week 38: Logistic Regression and Optimization
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1624,7 +1629,7 @@ theorem.</p>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Bootstrap Statistics :
|
||||
original bias std. error
|
||||
100.213 14.98 100.211 0.149466
|
||||
99.8244 15.0449 99.8227 0.150527
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1844,9 +1849,7 @@ Error: 0.08426840630693411
|
||||
Bias^2: 0.0796891867672603
|
||||
Var: 0.004579219539673834
|
||||
0.08426840630693411 >= 0.0796891867672603 + 0.004579219539673834 = 0.08426840630693413
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 2
|
||||
Polynomial degree: 2
|
||||
Error: 0.10398646080125035
|
||||
Bias^2: 0.1007711427354898
|
||||
Var: 0.0032153180657605116
|
||||
@@ -1873,9 +1876,7 @@ Error: 0.037813671417389005
|
||||
Bias^2: 0.033657685071527665
|
||||
Var: 0.00415598634586135
|
||||
0.037813671417389005 >= 0.033657685071527665 + 0.00415598634586135 = 0.03781367141738902
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 7
|
||||
Polynomial degree: 7
|
||||
Error: 0.02760977349102253
|
||||
Bias^2: 0.022999498260366312
|
||||
Var: 0.004610275230656212
|
||||
@@ -1890,16 +1891,17 @@ Error: 0.02660572763718093
|
||||
Bias^2: 0.010018312644137363
|
||||
Var: 0.016587414993043573
|
||||
0.02660572763718093 >= 0.010018312644137363 + 0.016587414993043573 = 0.026605727637180936
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 10
|
||||
Polynomial degree: 10
|
||||
Error: 0.021592704588025025
|
||||
Bias^2: 0.010516485576645508
|
||||
Var: 0.011076219011379514
|
||||
0.021592704588025025 >= 0.010516485576645508 + 0.011076219011379514 = 0.021592704588025022
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 11
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree:
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 11
|
||||
Error: 0.07160048164233104
|
||||
Bias^2: 0.014436800088904942
|
||||
Var: 0.05716368155342608
|
||||
@@ -1916,7 +1918,7 @@ Var: 0.20867052175034223
|
||||
0.22842468702219465 >= 0.01975416527185249 + 0.20867052175034223 = 0.2284246870221947
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week37_139_6.png" src="_images/week37_139_6.png" />
|
||||
<img alt="_images/week37_139_4.png" src="_images/week37_139_4.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2267,31 +2269,29 @@ Mean squared error on test data: 10.50427787
|
||||
Degree of polynomial: 7
|
||||
Mean squared error on training data: 0.47313680
|
||||
Mean squared error on test data: 1.53738247
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 8
|
||||
Degree of polynomial: 8
|
||||
Mean squared error on training data: 0.04926746
|
||||
Mean squared error on test data: 0.14629156
|
||||
Degree of polynomial: 9
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 9
|
||||
Mean squared error on training data: 0.02546675
|
||||
Mean squared error on test data: 0.11202337
|
||||
Degree of polynomial: 10
|
||||
Mean squared error on training data: 0.02424794
|
||||
Mean squared error on test data: 0.22467274
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 11
|
||||
Degree of polynomial: 11
|
||||
Mean squared error on training data: 0.01594452
|
||||
Mean squared error on test data: 1.07641937
|
||||
Degree of polynomial: 12
|
||||
Mean squared error on training data: 0.00805074
|
||||
Mean squared error on test data: 0.04295757
|
||||
Degree of polynomial: 13
|
||||
Mean squared error on training data: 0.00781918
|
||||
Mean squared error on test data: 0.56965674
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 14
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 13
|
||||
Mean squared error on training data: 0.00781918
|
||||
Mean squared error on test data: 0.56965674
|
||||
Degree of polynomial: 14
|
||||
Mean squared error on training data: 0.00465099
|
||||
Mean squared error on test data: 0.28443039
|
||||
Degree of polynomial: 15
|
||||
@@ -2311,31 +2311,29 @@ Mean squared error on test data: 429.25695398
|
||||
Degree of polynomial: 19
|
||||
Mean squared error on training data: 0.00154853
|
||||
Mean squared error on test data: 239.97065359
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 20
|
||||
Degree of polynomial: 20
|
||||
Mean squared error on training data: 0.00140846
|
||||
Mean squared error on test data: 1350.24493666
|
||||
Degree of polynomial: 21
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 21
|
||||
Mean squared error on training data: 0.00119688
|
||||
Mean squared error on test data: 1840.50530832
|
||||
Degree of polynomial: 22
|
||||
Mean squared error on training data: 0.00092898
|
||||
Mean squared error on test data: 1184.60929685
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 23
|
||||
Degree of polynomial: 23
|
||||
Mean squared error on training data: 0.00089193
|
||||
Mean squared error on test data: 3892.17483760
|
||||
Degree of polynomial: 24
|
||||
Mean squared error on training data: 0.00083355
|
||||
Mean squared error on test data: 1332.46736215
|
||||
Degree of polynomial: 25
|
||||
Mean squared error on training data: 0.00079904
|
||||
Mean squared error on test data: 7577.76690383
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 26
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 25
|
||||
Mean squared error on training data: 0.00079904
|
||||
Mean squared error on test data: 7577.76690383
|
||||
Degree of polynomial: 26
|
||||
Mean squared error on training data: 0.00075590
|
||||
Mean squared error on test data: 1079.36895644
|
||||
Degree of polynomial: 27
|
||||
@@ -2351,13 +2349,13 @@ Mean squared error on training data: 0.00063866
|
||||
Mean squared error on test data: 3099.60342978
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_6729/626635268.py:73: RuntimeWarning: divide by zero encountered in log10
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_58862/626635268.py:73: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(trainingerror), label='Training Error')
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_6729/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_58862/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week37_148_11.png" src="_images/week37_148_11.png" />
|
||||
<img alt="_images/week37_148_9.png" src="_images/week37_148_9.png" />
|
||||
</div>
|
||||
</div>
|
||||
<p>Note that we kept the intercept column in the fitting here. This means that we need to set the <strong>intercept</strong> in the call to the <strong>Scikit-Learn</strong> function as <strong>False</strong>. Alternatively, we could have set up the design matrix <span class="math notranslate nohighlight">\(X\)</span> without the first column of ones.</p>
|
||||
@@ -2438,7 +2436,7 @@ Mean squared error on test data: 3099.60342978
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_6729/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_58862/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user