adding dft slides
This commit is contained in:
@@ -333,6 +333,16 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 42 Constructing a Neural Network code with introduction to Tensor flow
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="exercisesweek43.html">
|
||||
Exercises weeks 43 and 44
|
||||
</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">
|
||||
@@ -869,10 +879,10 @@ number <span class="math notranslate nohighlight">\(i\)</span> is left out. Usin
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Runtime: 0.136236 sec
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Runtime: 0.134565 sec
|
||||
Jackknife Statistics :
|
||||
original bias std. error
|
||||
99.979 99.969 0.14845
|
||||
100.2 100.19 0.146591
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1091,7 +1101,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
|
||||
99.8342 14.8306 99.8351 0.14857
|
||||
99.9919 15.0954 99.9924 0.150989
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1313,14 +1323,14 @@ Error: 0.06844519414009445
|
||||
Bias^2: 0.06453579006728322
|
||||
Var: 0.003909404072811221
|
||||
0.06844519414009445 >= 0.06453579006728322 + 0.003909404072811221 = 0.06844519414009444
|
||||
Polynomial degree: 5
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 5
|
||||
Error: 0.05227921801205679
|
||||
Bias^2: 0.04818727730430286
|
||||
Var: 0.004091940707753925
|
||||
0.05227921801205679 >= 0.04818727730430286 + 0.004091940707753925 = 0.05227921801205679
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 6
|
||||
Polynomial degree: 6
|
||||
Error: 0.03781367141738902
|
||||
Bias^2: 0.03365768507152769
|
||||
Var: 0.0041559863458613296
|
||||
@@ -1640,12 +1650,12 @@ Mean squared error on test data: 1371.99051150
|
||||
Degree of polynomial: 20
|
||||
Mean squared error on training data: 0.00137818
|
||||
Mean squared error on test data: 1887.86252988
|
||||
Degree of polynomial: 21
|
||||
Mean squared error on training data: 0.00118508
|
||||
Mean squared error on test data: 14859.69908626
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 22
|
||||
<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.00118508
|
||||
Mean squared error on test data: 14859.69908626
|
||||
Degree of polynomial: 22
|
||||
Mean squared error on training data: 0.00092647
|
||||
Mean squared error on test data: 876.51191552
|
||||
Degree of polynomial: 23
|
||||
@@ -1660,12 +1670,12 @@ Mean squared error on test data: 128664.31650694
|
||||
Degree of polynomial: 26
|
||||
Mean squared error on training data: 0.00076905
|
||||
Mean squared error on test data: 19003.94822514
|
||||
Degree of polynomial: 27
|
||||
Mean squared error on training data: 0.00068946
|
||||
Mean squared error on test data: 2379.66219404
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 28
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 27
|
||||
Mean squared error on training data: 0.00068946
|
||||
Mean squared error on test data: 2379.66219404
|
||||
Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00062595
|
||||
Mean squared error on test data: 4082.19983530
|
||||
Degree of polynomial: 29
|
||||
@@ -1673,9 +1683,9 @@ Mean squared error on training data: 0.00060705
|
||||
Mean squared error on test data: 3250.17647619
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/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_10962/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_31624/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -1909,7 +1919,7 @@ cross-validation (LOOCV).</p>
|
||||
</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_31624/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_10962/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2798,9 +2808,9 @@ linear system as an equation would reduce this down to
|
||||
</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_31624/4162706317.py:6: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/4162706317.py:6: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
cb = fig.colorbar(im)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/4162706317.py:7: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/4162706317.py:7: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2944,9 +2954,9 @@ with the form utilized in linear regression, viz.</p>
|
||||
</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_31624/3777801602.py:6: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3777801602.py:6: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
cb = fig.colorbar(im)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/3777801602.py:7: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3777801602.py:7: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2986,9 +2996,9 @@ cost function is given by</p>
|
||||
</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_31624/438060758.py:9: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/438060758.py:9: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
cb = fig.colorbar(im)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/438060758.py:10: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/438060758.py:10: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3023,9 +3033,9 @@ cost function is given by</p>
|
||||
</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_31624/3544313922.py:8: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3544313922.py:8: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
cb = fig.colorbar(im)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/3544313922.py:9: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3544313922.py:9: UserWarning: FixedFormatter should only be used together with FixedLocator
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3078,43 +3088,43 @@ constant as opposed to ridge and OLS. We get a sparse solution with
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0%| | 0/10 [00:00<?, ?it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0%| | 0/10 [00:00<?, ?it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/sklearn/linear_model/_coordinate_descent.py:647: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations, check the scale of the features or consider increasing regularisation. Duality gap: 3.924e+00, tolerance: 1.797e+00
|
||||
model = cd_fast.enet_coordinate_descent(
|
||||
|
||||
10%|███████████▍ | 1/10 [00:00<00:08, 1.06it/s]
|
||||
10%|██████████████▌ | 1/10 [00:01<00:09, 1.07s/it]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 20%|██████████████████████▊ | 2/10 [00:01<00:07, 1.04it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 20%|█████████████████████████████ | 2/10 [00:02<00:08, 1.09s/it]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 30%|██████████████████████████████████▏ | 3/10 [00:02<00:05, 1.25it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 30%|███████████████████████████████████████████▌ | 3/10 [00:02<00:06, 1.07it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 40%|█████████████████████████████████████████████▌ | 4/10 [00:03<00:04, 1.36it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 40%|██████████████████████████████████████████████████████████ | 4/10 [00:03<00:05, 1.19it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 50%|█████████████████████████████████████████████████████████ | 5/10 [00:03<00:03, 1.43it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 50%|████████████████████████████████████████████████████████████████████████▌ | 5/10 [00:04<00:03, 1.26it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 60%|████████████████████████████████████████████████████████████████████▍ | 6/10 [00:04<00:02, 1.50it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 60%|███████████████████████████████████████████████████████████████████████████████████████ | 6/10 [00:05<00:03, 1.33it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|███████████████████████████████████████████████████████████████████████████████▊ | 7/10 [00:05<00:01, 1.55it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|█████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 7/10 [00:05<00:02, 1.35it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 80%|███████████████████████████████████████████████████████████████████████████████████████████▏ | 8/10 [00:05<00:01, 1.60it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 80%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 8/10 [00:06<00:01, 1.40it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 90%|██████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 9/10 [00:06<00:00, 1.61it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 90%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 9/10 [00:07<00:00, 1.42it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00, 1.62it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:07<00:00, 1.44it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00, 1.47it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:07<00:00, 1.29it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>
|
||||
@@ -3261,9 +3271,9 @@ which polynomial fits the data best.</p>
|
||||
</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_31624/3980313467.py:9: MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function should only be used to get the current axes, or if no axes exist, create new axes with default keyword arguments. To create a new axes with non-default arguments, use plt.axes() or plt.subplot().
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3980313467.py:9: MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function should only be used to get the current axes, or if no axes exist, create new axes with default keyword arguments. To create a new axes with non-default arguments, use plt.axes() or plt.subplot().
|
||||
ax = fig.gca(projection='3d')
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31624/3980313467.py:37: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10962/3980313467.py:37: MatplotlibDeprecationWarning: Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first.
|
||||
fig.colorbar(surf, shrink=0.5, aspect=5)
|
||||
</pre></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user