update lecture notes
@@ -6,11 +6,11 @@ edge [fontname="helvetica"] ;
|
||||
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
|
||||
2 [label="worst concave points <= 0.135\ngini = 0.031\nsamples = 253\nvalue = [[249, 4]\n[4, 249]]", fillcolor="#e78946"] ;
|
||||
1 -> 2 ;
|
||||
3 [label="area error <= 48.975\ngini = 0.008\nsamples = 242\nvalue = [[241, 1]\n[1, 241]]", fillcolor="#e5833c"] ;
|
||||
3 [label="radius error <= 0.643\ngini = 0.008\nsamples = 242\nvalue = [[241, 1]\n[1, 241]]", fillcolor="#e5833c"] ;
|
||||
2 -> 3 ;
|
||||
4 [label="gini = 0.0\nsamples = 239\nvalue = [[239, 0]\n[0, 239]]", fillcolor="#e58139"] ;
|
||||
3 -> 4 ;
|
||||
5 [label="symmetry error <= 0.025\ngini = 0.444\nsamples = 3\nvalue = [[2, 1]\n[1, 2]]", fillcolor="#fdf6f0"] ;
|
||||
5 [label="perimeter error <= 4.249\ngini = 0.444\nsamples = 3\nvalue = [[2, 1]\n[1, 2]]", fillcolor="#fdf6f0"] ;
|
||||
3 -> 5 ;
|
||||
6 [label="gini = 0.0\nsamples = 1\nvalue = [[0, 1]\n[1, 0]]", fillcolor="#e58139"] ;
|
||||
5 -> 6 ;
|
||||
@@ -34,7 +34,7 @@ edge [fontname="helvetica"] ;
|
||||
14 -> 15 ;
|
||||
16 [label="gini = 0.0\nsamples = 11\nvalue = [[11, 0]\n[0, 11]]", fillcolor="#e58139"] ;
|
||||
15 -> 16 ;
|
||||
17 [label="area error <= 23.16\ngini = 0.32\nsamples = 5\nvalue = [[1, 4]\n[4, 1]]", fillcolor="#f6d5bd"] ;
|
||||
17 [label="mean perimeter <= 98.115\ngini = 0.32\nsamples = 5\nvalue = [[1, 4]\n[4, 1]]", fillcolor="#f6d5bd"] ;
|
||||
15 -> 17 ;
|
||||
18 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139"] ;
|
||||
17 -> 18 ;
|
||||
|
||||
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 554 KiB |
|
After Width: | Height: | Size: 546 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 565 KiB |
|
After Width: | Height: | Size: 292 KiB |
|
After Width: | Height: | Size: 338 KiB |
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 495 KiB |
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -855,9 +860,7 @@ classification.</p>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(426, 30)
|
||||
(143, 30)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Test set accuracy with Logistic Regression: 0.94
|
||||
Test set accuracy with Logistic Regression: 0.94
|
||||
</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/_logistic.py:460: ConvergenceWarning: lbfgs failed to converge (status=1):
|
||||
@@ -997,6 +1000,9 @@ applications. This will be discussed later this semester (<a class="reference ex
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(426, 30)
|
||||
(143, 30)
|
||||
[1. 0.86666667 1. 0.85714286 1. 0.85714286
|
||||
1. 0.92857143 0.92857143 1. ]
|
||||
Test set accuracy with Logistic Regression: 0.94
|
||||
</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/_logistic.py:460: ConvergenceWarning: lbfgs failed to converge (status=1):
|
||||
@@ -1089,14 +1095,9 @@ Please also refer to the documentation for alternative solver options:
|
||||
n_iter_i = _check_optimize_result(
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[1. 0.86666667 1. 0.85714286 1. 0.85714286
|
||||
1. 0.92857143 0.92857143 1. ]
|
||||
Test set accuracy with Logistic Regression: 0.94
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/additionweek42_50_2.png" src="_images/additionweek42_50_2.png" />
|
||||
<img alt="_images/additionweek42_50_3.png" src="_images/additionweek42_50_3.png" />
|
||||
<img alt="_images/additionweek42_50_4.png" src="_images/additionweek42_50_4.png" />
|
||||
<img alt="_images/additionweek42_50_5.png" src="_images/additionweek42_50_5.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1081,13 +1086,13 @@ example of the functionality of <strong>Scikit-Learn</strong>.</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The intercept alpha:
|
||||
[1.97438607]
|
||||
[1.97977855]
|
||||
Coefficient beta :
|
||||
[[5.01837528]]
|
||||
Mean squared error: 0.24
|
||||
Variance score: 0.91
|
||||
[[5.06813806]]
|
||||
Mean squared error: 0.20
|
||||
Variance score: 0.90
|
||||
Mean squared log error: 0.01
|
||||
Mean absolute error: 0.41
|
||||
Mean absolute error: 0.37
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter1_19_1.png" src="_images/chapter1_19_1.png" />
|
||||
@@ -1187,7 +1192,7 @@ a linear <span class="math notranslate nohighlight">\(x\)</span>-dependence we s
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<img alt="_images/chapter1_33_0.png" src="_images/chapter1_33_0.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.005000000000000009
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.004999999999999996
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1398,7 +1403,7 @@ the <em>Hadamard product</em>, meaning element-wise multiplication.</p>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Old accuracy on training data: 0.1440501043841336
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20753/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -1732,103 +1737,10 @@ Lambda = 10.0
|
||||
Accuracy score on test set: 0.19166666666666668
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20753/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 1e-05
|
||||
Accuracy score on test set: 0.10555555555555556
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 0.0001
|
||||
Accuracy score on test set: 0.08611111111111111
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 0.001
|
||||
Accuracy score on test set: 0.10555555555555556
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 0.01
|
||||
Accuracy score on test set: 0.08888888888888889
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 0.1
|
||||
Accuracy score on test set: 0.08611111111111111
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 1.0
|
||||
Accuracy score on test set: 0.08888888888888889
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.1
|
||||
Lambda = 10.0
|
||||
Accuracy score on test set: 0.09166666666666666
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:44: RuntimeWarning: invalid value encountered in divide
|
||||
self.probabilities = exp_term / np.sum(exp_term, axis=1, keepdims=True)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 1.0
|
||||
Lambda = 1e-05
|
||||
Accuracy score on test set: 0.07777777777777778
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:44: RuntimeWarning: invalid value encountered in divide
|
||||
self.probabilities = exp_term / np.sum(exp_term, axis=1, keepdims=True)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 1.0
|
||||
Lambda = 0.0001
|
||||
Accuracy score on test set: 0.07777777777777778
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94023/1630775253.py:44: RuntimeWarning: invalid value encountered in divide
|
||||
self.probabilities = exp_term / np.sum(exp_term, axis=1, keepdims=True)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
|
||||
<span class="ne">KeyboardInterrupt</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
|
||||
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">8</span><span class="p">],</span> <span class="n">line</span> <span class="mi">11</span>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1330,10 +1335,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.06291984474217532
|
||||
4.095077148135215
|
||||
[[0.8942779 2.56719397]
|
||||
[2.56719397 8.13485566]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.03726977611299938
|
||||
4.262466605211622
|
||||
[[0.83354173 2.32104741]
|
||||
[2.32104741 7.32657772]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1370,10 +1375,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.07603598322691016
|
||||
1.4323043635926456
|
||||
[[1. 0.58435095]
|
||||
[0.58435095 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07860645184491624
|
||||
1.2936571226638978
|
||||
[[1. 0.66747609]
|
||||
[0.66747609 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1403,30 +1408,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.2105986 -2.92044261]
|
||||
[-0.59585933 -2.0072114 ]
|
||||
[-0.7336627 -1.27166993]
|
||||
[ 0.50493371 0.54649725]
|
||||
[-0.76911228 -2.66017222]
|
||||
[ 0.70843895 3.92226956]
|
||||
[ 0.61516316 2.7399476 ]
|
||||
[ 0.3114655 -0.76958689]
|
||||
[ 1.49817031 3.74791021]
|
||||
[-0.32893873 -1.32754157]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.26697306 0.29778864]
|
||||
[-2.19869916 -6.93548204]
|
||||
[ 0.7618873 2.50605353]
|
||||
[-0.42441412 -1.40921665]
|
||||
[ 0.4871032 0.64995019]
|
||||
[ 1.20793948 2.61639509]
|
||||
[ 0.97826564 2.87523613]
|
||||
[-1.00907717 -2.99547963]
|
||||
[ 0.78152283 3.2948209 ]
|
||||
[-0.31755493 -0.90006616]]
|
||||
0 1
|
||||
0 -1.210599 -2.920443
|
||||
1 -0.595859 -2.007211
|
||||
2 -0.733663 -1.271670
|
||||
3 0.504934 0.546497
|
||||
4 -0.769112 -2.660172
|
||||
5 0.708439 3.922270
|
||||
6 0.615163 2.739948
|
||||
7 0.311466 -0.769587
|
||||
8 1.498170 3.747910
|
||||
9 -0.328939 -1.327542
|
||||
0 -0.266973 0.297789
|
||||
1 -2.198699 -6.935482
|
||||
2 0.761887 2.506054
|
||||
3 -0.424414 -1.409217
|
||||
4 0.487103 0.649950
|
||||
5 1.207939 2.616395
|
||||
6 0.978266 2.875236
|
||||
7 -1.009077 -2.995480
|
||||
8 0.781523 3.294821
|
||||
9 -0.317555 -0.900066
|
||||
0 1
|
||||
0 1.000000 0.915842
|
||||
1 0.915842 1.000000
|
||||
0 1.000000 0.978369
|
||||
1 0.978369 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1483,37 +1488,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.083046 0.078912 0.083582 0.082947 0.081772 0.074931 0.074984
|
||||
2 0.0 0.078912 0.078913 0.075718 0.076758 0.077825 0.065957 0.066785
|
||||
3 0.0 0.083582 0.075718 0.089055 0.086655 0.083266 0.082876 0.082018
|
||||
4 0.0 0.082947 0.076758 0.086655 0.085096 0.082753 0.079657 0.079265
|
||||
5 0.0 0.081772 0.077825 0.083266 0.082753 0.081750 0.075343 0.075494
|
||||
6 0.0 0.074931 0.065957 0.082876 0.079657 0.075343 0.079164 0.077785
|
||||
7 0.0 0.074984 0.066785 0.082018 0.079265 0.075494 0.077785 0.076698
|
||||
8 0.0 0.074979 0.067759 0.080910 0.078709 0.075600 0.076076 0.075321
|
||||
9 0.0 0.074820 0.068872 0.079393 0.077861 0.075576 0.073869 0.073497
|
||||
10 0.0 0.066329 0.057411 0.075255 0.071789 0.067261 0.073246 0.071643
|
||||
11 0.0 0.066412 0.057907 0.074831 0.071648 0.067437 0.072501 0.071093
|
||||
12 0.0 0.066546 0.058532 0.074371 0.071511 0.067667 0.071672 0.070480
|
||||
13 0.0 0.066707 0.059294 0.073827 0.071341 0.067930 0.070701 0.069750
|
||||
14 0.0 0.066858 0.060197 0.073125 0.071081 0.068193 0.069506 0.068828
|
||||
1 0.0 0.090448 0.082216 0.088200 0.084006 0.079901 0.077733 0.074768
|
||||
2 0.0 0.082216 0.075560 0.081246 0.077794 0.074400 0.072599 0.070081
|
||||
3 0.0 0.088200 0.081246 0.091136 0.087474 0.083840 0.083597 0.080857
|
||||
4 0.0 0.084006 0.077794 0.087474 0.084194 0.080928 0.080799 0.078308
|
||||
5 0.0 0.079901 0.074400 0.083840 0.080928 0.078015 0.077985 0.075733
|
||||
6 0.0 0.077733 0.072599 0.083597 0.080799 0.077985 0.079026 0.076796
|
||||
7 0.0 0.074768 0.070081 0.080857 0.078308 0.075733 0.076796 0.074738
|
||||
8 0.0 0.071947 0.067679 0.078227 0.075911 0.073561 0.074636 0.072742
|
||||
9 0.0 0.069255 0.065380 0.075695 0.073598 0.071461 0.072539 0.070801
|
||||
10 0.0 0.068030 0.064276 0.075365 0.073257 0.071105 0.072914 0.071121
|
||||
11 0.0 0.065704 0.062251 0.073098 0.071167 0.069187 0.070966 0.069305
|
||||
12 0.0 0.063502 0.060329 0.070937 0.069172 0.067353 0.069098 0.067561
|
||||
13 0.0 0.061415 0.058504 0.068877 0.067267 0.065599 0.067306 0.065886
|
||||
14 0.0 0.059435 0.056769 0.066909 0.065446 0.063921 0.065586 0.064277
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
1 0.074979 0.074820 0.066329 0.066412 0.066546 0.066707 0.066858
|
||||
2 0.067759 0.068872 0.057411 0.057907 0.058532 0.059294 0.060197
|
||||
3 0.080910 0.079393 0.075255 0.074831 0.074371 0.073827 0.073125
|
||||
4 0.078709 0.077861 0.071789 0.071648 0.071511 0.071341 0.071081
|
||||
5 0.075600 0.075576 0.067261 0.067437 0.067667 0.067930 0.068193
|
||||
6 0.076076 0.073869 0.073246 0.072501 0.071672 0.070701 0.069506
|
||||
7 0.075321 0.073497 0.071643 0.071093 0.070480 0.069750 0.068828
|
||||
8 0.074328 0.072954 0.069693 0.069359 0.068986 0.068528 0.067920
|
||||
9 0.072954 0.072121 0.067239 0.067143 0.067040 0.066893 0.066650
|
||||
10 0.069693 0.067239 0.068729 0.067831 0.066827 0.065661 0.064254
|
||||
11 0.069359 0.067143 0.067831 0.067072 0.066218 0.065217 0.063990
|
||||
12 0.068986 0.067040 0.066827 0.066218 0.065529 0.064708 0.063682
|
||||
13 0.068528 0.066893 0.065661 0.065217 0.064708 0.064088 0.063287
|
||||
14 0.067920 0.066650 0.064254 0.063990 0.063682 0.063287 0.062745
|
||||
1 0.071947 0.069255 0.068030 0.065704 0.063502 0.061415 0.059435
|
||||
2 0.067679 0.065380 0.064276 0.062251 0.060329 0.058504 0.056769
|
||||
3 0.078227 0.075695 0.075365 0.073098 0.070937 0.068877 0.066909
|
||||
4 0.075911 0.073598 0.073257 0.071167 0.069172 0.067267 0.065446
|
||||
5 0.073561 0.071461 0.071105 0.069187 0.067353 0.065599 0.063921
|
||||
6 0.074636 0.072539 0.072914 0.070966 0.069098 0.067306 0.065586
|
||||
7 0.072742 0.070801 0.071121 0.069305 0.067561 0.065886 0.064277
|
||||
8 0.070901 0.069107 0.069371 0.067680 0.066054 0.064491 0.062988
|
||||
9 0.069107 0.067454 0.067659 0.066088 0.064575 0.063119 0.061718
|
||||
10 0.069371 0.067659 0.068506 0.066860 0.065272 0.063740 0.062261
|
||||
11 0.067680 0.066088 0.066860 0.065318 0.063830 0.062393 0.061005
|
||||
12 0.066054 0.064575 0.065272 0.063830 0.062436 0.061089 0.059788
|
||||
13 0.064491 0.063119 0.063740 0.062393 0.061089 0.059829 0.058609
|
||||
14 0.062988 0.061718 0.062261 0.061005 0.059788 0.058609 0.057468
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -884,10 +889,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.147161 sec
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Runtime: 0.156654 sec
|
||||
Jackknife Statistics :
|
||||
original bias std. error
|
||||
100.113 100.103 0.15078
|
||||
100.193 100.183 0.150667
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1106,7 +1111,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.966 14.8724 99.9645 0.146212
|
||||
100.159 15.0085 100.157 0.150625
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1318,9 +1323,7 @@ Error: 0.10398646080125035
|
||||
Bias^2: 0.1007711427354898
|
||||
Var: 0.0032153180657605116
|
||||
0.10398646080125035 >= 0.1007711427354898 + 0.0032153180657605116 = 0.10398646080125032
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 3
|
||||
Polynomial degree: 3
|
||||
Error: 0.06547790180152355
|
||||
Bias^2: 0.06208238634231949
|
||||
Var: 0.0033955154592040936
|
||||
@@ -1335,7 +1338,9 @@ Error: 0.05227921801205686
|
||||
Bias^2: 0.0481872773043029
|
||||
Var: 0.004091940707753939
|
||||
0.05227921801205686 >= 0.0481872773043029 + 0.004091940707753939 = 0.052279218012056844
|
||||
Polynomial degree: 6
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 6
|
||||
Error: 0.037813671417389005
|
||||
Bias^2: 0.033657685071527665
|
||||
Var: 0.00415598634586135
|
||||
@@ -1350,9 +1355,7 @@ Error: 0.017355848195593347
|
||||
Bias^2: 0.010331721306655127
|
||||
Var: 0.007024126888938232
|
||||
0.017355848195593347 >= 0.010331721306655127 + 0.007024126888938232 = 0.01735584819559336
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 9
|
||||
Polynomial degree: 9
|
||||
Error: 0.02660572763718093
|
||||
Bias^2: 0.010018312644137363
|
||||
Var: 0.016587414993043573
|
||||
@@ -1369,7 +1372,9 @@ Error: 0.07160048164233104
|
||||
Bias^2: 0.014436800088904942
|
||||
Var: 0.05716368155342608
|
||||
0.07160048164233104 >= 0.014436800088904942 + 0.05716368155342608 = 0.07160048164233102
|
||||
Polynomial degree: 12
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 12
|
||||
Error: 0.11547777218872497
|
||||
Bias^2: 0.01628578269596628
|
||||
Var: 0.09919198949275869
|
||||
@@ -1630,29 +1635,31 @@ Mean squared error on test data: 1.20015436
|
||||
Degree of polynomial: 11
|
||||
Mean squared error on training data: 0.01640891
|
||||
Mean squared error on test data: 1.35533773
|
||||
Degree of polynomial: 12
|
||||
Mean squared error on training data: 0.00813803
|
||||
Mean squared error on test data: 0.17446471
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 13
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 12
|
||||
Mean squared error on training data: 0.00813803
|
||||
Mean squared error on test data: 0.17446471
|
||||
Degree of polynomial: 13
|
||||
Mean squared error on training data: 0.00759119
|
||||
Mean squared error on test data: 1.08131003
|
||||
Degree of polynomial: 14
|
||||
Mean squared error on training data: 0.00472199
|
||||
Mean squared error on test data: 0.81333808
|
||||
Degree of polynomial: 15
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 15
|
||||
Mean squared error on training data: 0.00410478
|
||||
Mean squared error on test data: 92.09163947
|
||||
Degree of polynomial: 16
|
||||
Mean squared error on training data: 0.00315593
|
||||
Mean squared error on test data: 234.38827994
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 17
|
||||
Degree of polynomial: 17
|
||||
Mean squared error on training data: 0.00242999
|
||||
Mean squared error on test data: 1271.34367970
|
||||
Degree of polynomial: 18
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 18
|
||||
Mean squared error on training data: 0.00228740
|
||||
Mean squared error on test data: 108.21093775
|
||||
Degree of polynomial: 19
|
||||
@@ -1661,12 +1668,12 @@ Mean squared error on test data: 1385.79778008
|
||||
Degree of polynomial: 20
|
||||
Mean squared error on training data: 0.00137814
|
||||
Mean squared error on test data: 1944.86062977
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 21
|
||||
Degree of polynomial: 21
|
||||
Mean squared error on training data: 0.00118584
|
||||
Mean squared error on test data: 14716.58827236
|
||||
Degree of polynomial: 22
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 22
|
||||
Mean squared error on training data: 0.00092678
|
||||
Mean squared error on test data: 877.21517262
|
||||
Degree of polynomial: 23
|
||||
@@ -1675,12 +1682,12 @@ Mean squared error on test data: 5567.04664255
|
||||
Degree of polynomial: 24
|
||||
Mean squared error on training data: 0.00084707
|
||||
Mean squared error on test data: 1325.26124692
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 25
|
||||
Degree of polynomial: 25
|
||||
Mean squared error on training data: 0.00079125
|
||||
Mean squared error on test data: 129012.83870189
|
||||
Degree of polynomial: 26
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 26
|
||||
Mean squared error on training data: 0.00076908
|
||||
Mean squared error on test data: 18388.59354079
|
||||
Degree of polynomial: 27
|
||||
@@ -1689,16 +1696,14 @@ Mean squared error on test data: 2351.97979891
|
||||
Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00062592
|
||||
Mean squared error on test data: 3983.63037846
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 29
|
||||
Degree of polynomial: 29
|
||||
Mean squared error on training data: 0.00060704
|
||||
Mean squared error on test data: 3262.26814548
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94076/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_20789/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_94076/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20789/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -1932,7 +1937,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_94076/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_20789/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2821,7 +2826,7 @@ 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_94076/4162706317.py:7: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20789/4162706317.py:7: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2965,7 +2970,7 @@ 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_94076/3777801602.py:7: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20789/3777801602.py:7: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3005,7 +3010,7 @@ 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_94076/438060758.py:10: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20789/438060758.py:10: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3040,7 +3045,7 @@ 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_94076/3544313922.py:9: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20789/3544313922.py:9: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
|
||||
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=18)
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3093,43 +3098,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:628: 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:07, 1.17it/s]
|
||||
10%|██████████ | 1/10 [00:00<00:06, 1.30it/s]
|
||||
</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.12it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 20%|████████████████████ | 2/10 [00:01<00:06, 1.25it/s]
|
||||
</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.33it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 30%|██████████████████████████████ | 3/10 [00:02<00:04, 1.44it/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.41it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 40%|████████████████████████████████████████ | 4/10 [00:02<00:03, 1.52it/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.51it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 50%|██████████████████████████████████████████████████ | 5/10 [00:03<00:03, 1.53it/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.54it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 60%|████████████████████████████████████████████████████████████ | 6/10 [00:04<00:02, 1.54it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|██████████████████████████████████████████████████████████████████████████████▍ | 7/10 [00:04<00:01, 1.56it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|██████████████████████████████████████████████████████████████████████ | 7/10 [00:04<00:02, 1.46it/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.48it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 80%|████████████████████████████████████████████████████████████████████████████████ | 8/10 [00:05<00:01, 1.49it/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.43it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 90%|██████████████████████████████████████████████████████████████████████████████████████████ | 9/10 [00:06<00:00, 1.50it/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.52it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00, 1.55it/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.45it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00, 1.49it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -812,9 +817,9 @@ predicting the target features of query instances is as follows:</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2nd degree coefficients:
|
||||
zero power: 2.1974520015546233
|
||||
first power: -0.07706200276162956
|
||||
second power: -0.00041883582579717597
|
||||
zero power: -0.7397605907501061
|
||||
first power: 0.007373805280423706
|
||||
second power: 0.00026005429911763394
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter6_1_1.png" src="_images/chapter6_1_1.png" />
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -766,10 +771,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.1255057631975562
|
||||
3.579533981545493
|
||||
[[0.80708107 2.37821193]
|
||||
[2.37821193 8.11221557]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.0610096522011426
|
||||
3.8847504075456363
|
||||
[[ 1.07280604 3.11827698]
|
||||
[ 3.11827698 10.20730033]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -809,10 +814,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.07588754093232836
|
||||
1.3745699019323765
|
||||
[[1. 0.60314576]
|
||||
[0.60314576 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.08699604706693358
|
||||
1.8785678201327416
|
||||
[[1. 0.67701729]
|
||||
[0.67701729 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -841,30 +846,32 @@ 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.4664985 -5.74309684]
|
||||
[ 0.4437291 1.90952533]
|
||||
[ 1.55472805 4.78691713]
|
||||
[-1.49928561 -4.52502695]
|
||||
[ 1.17766528 3.5035492 ]
|
||||
[-1.53311882 -4.84616248]
|
||||
[ 0.58757487 2.2352456 ]
|
||||
[-1.60585931 -5.88080569]
|
||||
[ 1.30905952 3.50820404]
|
||||
[ 1.03200542 5.05165065]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.56439048 -1.59243304]
|
||||
[ 0.34744134 -0.79671424]
|
||||
[-1.55842946 -5.7693748 ]
|
||||
[ 0.1084649 0.43675706]
|
||||
[-0.34689964 -0.80973749]
|
||||
[ 0.54581307 1.66293202]
|
||||
[-0.38075194 -0.87904563]
|
||||
[ 0.89964122 5.25714271]
|
||||
[ 0.67258465 1.91633883]
|
||||
[ 0.27652633 0.57413459]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 0 1
|
||||
0 -0.564390 -1.592433
|
||||
1 0.347441 -0.796714
|
||||
2 -1.558429 -5.769375
|
||||
3 0.108465 0.436757
|
||||
4 -0.346900 -0.809737
|
||||
5 0.545813 1.662932
|
||||
6 -0.380752 -0.879046
|
||||
7 0.899641 5.257143
|
||||
8 0.672585 1.916339
|
||||
9 0.276526 0.574135
|
||||
0 1
|
||||
0 -1.466499 -5.743097
|
||||
1 0.443729 1.909525
|
||||
2 1.554728 4.786917
|
||||
3 -1.499286 -4.525027
|
||||
4 1.177665 3.503549
|
||||
5 -1.533119 -4.846162
|
||||
6 0.587575 2.235246
|
||||
7 -1.605859 -5.880806
|
||||
8 1.309060 3.508204
|
||||
9 1.032005 5.051651
|
||||
0 1
|
||||
0 1.000000 0.986472
|
||||
1 0.986472 1.000000
|
||||
0 1.000000 0.932605
|
||||
1 0.932605 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -921,37 +928,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.083504 0.075256 0.078921 0.075567 0.072065 0.068904 0.066579
|
||||
2 0.0 0.075256 0.068613 0.070518 0.067902 0.065165 0.061508 0.059695
|
||||
3 0.0 0.078921 0.070518 0.080620 0.076840 0.072951 0.073809 0.071199
|
||||
4 0.0 0.075567 0.067902 0.076840 0.073512 0.070072 0.070294 0.068019
|
||||
5 0.0 0.072065 0.065165 0.072951 0.070072 0.067082 0.066709 0.064764
|
||||
6 0.0 0.068904 0.061508 0.073809 0.070294 0.066709 0.069698 0.067255
|
||||
7 0.0 0.066579 0.059695 0.071199 0.068019 0.064764 0.067255 0.065071
|
||||
8 0.0 0.064363 0.057976 0.068705 0.065848 0.062910 0.064922 0.062985
|
||||
9 0.0 0.062226 0.056324 0.066296 0.063752 0.061123 0.062673 0.060974
|
||||
10 0.0 0.059775 0.053480 0.066103 0.063023 0.059897 0.063806 0.061651
|
||||
11 0.0 0.057936 0.052040 0.064062 0.061249 0.058385 0.061895 0.059951
|
||||
12 0.0 0.056217 0.050702 0.062151 0.059593 0.056978 0.060108 0.058364
|
||||
13 0.0 0.054609 0.049456 0.060358 0.058043 0.055668 0.058432 0.056880
|
||||
14 0.0 0.053099 0.048295 0.058671 0.056590 0.054443 0.056857 0.055488
|
||||
1 0.0 0.079059 0.081365 0.076315 0.081270 0.086391 0.066334 0.070891
|
||||
2 0.0 0.081365 0.085489 0.076059 0.081793 0.087930 0.064777 0.069667
|
||||
3 0.0 0.076315 0.076059 0.078398 0.082223 0.085871 0.071052 0.075199
|
||||
4 0.0 0.081270 0.081793 0.082223 0.086686 0.091074 0.073735 0.078326
|
||||
5 0.0 0.086391 0.087930 0.085871 0.091074 0.096339 0.076078 0.081151
|
||||
6 0.0 0.066334 0.064777 0.071052 0.073735 0.076078 0.066329 0.069696
|
||||
7 0.0 0.070891 0.069667 0.075199 0.078326 0.081151 0.069696 0.073438
|
||||
8 0.0 0.075831 0.075047 0.079570 0.083213 0.086609 0.073167 0.077326
|
||||
9 0.0 0.081169 0.080964 0.084139 0.088383 0.092454 0.076692 0.081316
|
||||
10 0.0 0.057338 0.055249 0.063213 0.065107 0.066605 0.060295 0.063007
|
||||
11 0.0 0.061147 0.059192 0.066951 0.069155 0.070974 0.063515 0.066524
|
||||
12 0.0 0.065303 0.063532 0.070967 0.073529 0.075723 0.066934 0.070275
|
||||
13 0.0 0.069840 0.068317 0.075276 0.078251 0.080886 0.070553 0.074265
|
||||
14 0.0 0.074791 0.073599 0.079886 0.083341 0.086493 0.074366 0.078493
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
1 0.064363 0.062226 0.059775 0.057936 0.056217 0.054609 0.053099
|
||||
2 0.057976 0.056324 0.053480 0.052040 0.050702 0.049456 0.048295
|
||||
3 0.068705 0.066296 0.066103 0.064062 0.062151 0.060358 0.058671
|
||||
4 0.065848 0.063752 0.063023 0.061249 0.059593 0.058043 0.056590
|
||||
5 0.062910 0.061123 0.059897 0.058385 0.056978 0.055668 0.054443
|
||||
6 0.064922 0.062673 0.063806 0.061895 0.060108 0.058432 0.056857
|
||||
7 0.062985 0.060974 0.061651 0.059951 0.058364 0.056880 0.055488
|
||||
8 0.061136 0.059355 0.059595 0.058098 0.056703 0.055402 0.054185
|
||||
9 0.059355 0.057796 0.057619 0.056315 0.055105 0.053981 0.052934
|
||||
10 0.059595 0.057619 0.059363 0.057675 0.056097 0.054621 0.053236
|
||||
11 0.058098 0.056315 0.057675 0.056161 0.054750 0.053432 0.052199
|
||||
12 0.056703 0.055105 0.056097 0.054750 0.053497 0.052330 0.051241
|
||||
13 0.055402 0.053981 0.054621 0.053432 0.052330 0.051307 0.050356
|
||||
14 0.054185 0.052934 0.053236 0.052199 0.051241 0.050356 0.049538
|
||||
1 0.075831 0.081169 0.057338 0.061147 0.065303 0.069840 0.074791
|
||||
2 0.075047 0.080964 0.055249 0.059192 0.063532 0.068317 0.073599
|
||||
3 0.079570 0.084139 0.063213 0.066951 0.070967 0.075276 0.079886
|
||||
4 0.083213 0.088383 0.065107 0.069155 0.073529 0.078251 0.083341
|
||||
5 0.086609 0.092454 0.066605 0.070974 0.075723 0.080886 0.086493
|
||||
6 0.073167 0.076692 0.060295 0.063515 0.066934 0.070553 0.074366
|
||||
7 0.077326 0.081316 0.063007 0.066524 0.070275 0.074265 0.078493
|
||||
8 0.081683 0.086203 0.065751 0.069590 0.073705 0.078104 0.082794
|
||||
9 0.086203 0.091326 0.068471 0.072660 0.077172 0.082023 0.087227
|
||||
10 0.065751 0.068471 0.055720 0.058436 0.061294 0.064287 0.067400
|
||||
11 0.069590 0.072660 0.058436 0.061405 0.064542 0.067841 0.071290
|
||||
12 0.073705 0.077172 0.061294 0.064542 0.067986 0.071624 0.075448
|
||||
13 0.078104 0.082023 0.064287 0.067841 0.071624 0.075640 0.079883
|
||||
14 0.082794 0.087227 0.067400 0.071290 0.075448 0.079883 0.084595
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1140,10 +1147,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.969573 1.988769
|
||||
1 1.988769 2.007390
|
||||
[[3.96957289 1.98876882]
|
||||
[1.98876882 2.00738983]]
|
||||
0 4.021032 1.990843
|
||||
1 1.990843 1.969959
|
||||
[[4.02103235 1.99084335]
|
||||
[1.99084335 1.9699594 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1170,8 +1177,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.96957289 1.98876882]
|
||||
[1.98876882 2.00738983]]
|
||||
[[4.02103235 1.99084335]
|
||||
[1.99084335 1.9699594 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
|
||||
@@ -1231,16 +1238,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.206079615468402
|
||||
0.7708831044105582
|
||||
5.234956145890017
|
||||
0.7560356057040467
|
||||
First eigenvector
|
||||
[0.84923841 0.52800959]
|
||||
[0.85379714 0.52060584]
|
||||
Second eigenvector
|
||||
[-0.52800959 0.84923841]
|
||||
[-0.52060584 0.85379714]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
|
||||
[-0.84923841 -0.52800959]
|
||||
[-0.85379714 -0.52060584]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -346,6 +346,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -819,15 +824,15 @@ regression.</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.15515965]
|
||||
[2.99763835]]
|
||||
Eigenvalues of Hessian Matrix:[0.3156062 4.19886862]
|
||||
[[3.72796854]
|
||||
[3.26269704]]
|
||||
Eigenvalues of Hessian Matrix:[0.26876494 4.16606994]
|
||||
theta from own gd
|
||||
[[4.15515965]
|
||||
[2.99763835]]
|
||||
[[3.72796854]
|
||||
[3.26269704]]
|
||||
theta from own sdg
|
||||
[[4.18290649]
|
||||
[2.96486591]]
|
||||
[[3.70521262]
|
||||
[3.29966563]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_5_1.png" src="_images/exercisesweek41_5_1.png" />
|
||||
@@ -949,12 +954,12 @@ first example shows results with ordinary leats squares.</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[3.98635543]
|
||||
[2.9642492 ]]
|
||||
Eigenvalues of Hessian Matrix:[0.31545424 4.4234122 ]
|
||||
[[3.89549614]
|
||||
[2.9788957 ]]
|
||||
Eigenvalues of Hessian Matrix:[0.34210288 4.43495138]
|
||||
theta from own gd
|
||||
[[3.98635543]
|
||||
[2.9642492 ]]
|
||||
[[3.89549614]
|
||||
[2.9788957 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_16_1.png" src="_images/exercisesweek41_16_1.png" />
|
||||
@@ -1025,73 +1030,73 @@ theta from own gd
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.]
|
||||
[3.]]
|
||||
Eigenvalues of Hessian Matrix:[0.35350927 4.2330123 ]
|
||||
0 [-10.02028415] [-11.38281882]
|
||||
1 [-0.12978318] [0.11144292]
|
||||
2 [-0.11894467] [0.10213605]
|
||||
3 [-0.10901131] [0.09360642]
|
||||
4 [-0.0999075] [0.08578912]
|
||||
5 [-0.09156398] [0.07862466]
|
||||
6 [-0.08391725] [0.07205852]
|
||||
7 [-0.07690911] [0.06604073]
|
||||
8 [-0.07048624] [0.06052551]
|
||||
9 [-0.06459976] [0.05547088]
|
||||
10 [-0.05920488] [0.05083837]
|
||||
11 [-0.05426053] [0.04659273]
|
||||
12 [-0.0497291] [0.04270166]
|
||||
13 [-0.0455761] [0.03913554]
|
||||
14 [-0.04176993] [0.03586723]
|
||||
15 [-0.03828162] [0.03287187]
|
||||
16 [-0.03508463] [0.03012666]
|
||||
17 [-0.03215463] [0.02761071]
|
||||
18 [-0.02946931] [0.02530487]
|
||||
19 [-0.02700826] [0.0231916]
|
||||
20 [-0.02475273] [0.02125481]
|
||||
21 [-0.02268557] [0.01947977]
|
||||
22 [-0.02079104] [0.01785297]
|
||||
23 [-0.01905473] [0.01636202]
|
||||
24 [-0.01746342] [0.01499559]
|
||||
25 [-0.01600501] [0.01374327]
|
||||
26 [-0.01466839] [0.01259554]
|
||||
27 [-0.0134434] [0.01154365]
|
||||
28 [-0.01232071] [0.01057961]
|
||||
29 [-0.01129178] [0.00969608]
|
||||
Eigenvalues of Hessian Matrix:[0.35622964 3.83344349]
|
||||
0 [-10.84597523] [-10.53597191]
|
||||
1 [-0.41603353] [0.39392645]
|
||||
2 [-0.37737287] [0.35732012]
|
||||
3 [-0.34230481] [0.32411551]
|
||||
4 [-0.31049552] [0.29399649]
|
||||
5 [-0.28164216] [0.26667634]
|
||||
6 [-0.25547006] [0.24189496]
|
||||
7 [-0.23173004] [0.21941643]
|
||||
8 [-0.21019611] [0.19902677]
|
||||
9 [-0.19066326] [0.18053184]
|
||||
10 [-0.17294553] [0.1637556]
|
||||
11 [-0.15687426] [0.14853831]
|
||||
12 [-0.14229643] [0.13473512]
|
||||
13 [-0.12907328] [0.12221462]
|
||||
14 [-0.11707891] [0.11085761]
|
||||
15 [-0.10619914] [0.10055596]
|
||||
16 [-0.0963304] [0.09121162]
|
||||
17 [-0.08737872] [0.08273561]
|
||||
18 [-0.0792589] [0.07504726]
|
||||
19 [-0.07189362] [0.06807336]
|
||||
20 [-0.06521278] [0.06174752]
|
||||
21 [-0.05915276] [0.05600952]
|
||||
22 [-0.05365588] [0.05080473]
|
||||
23 [-0.04866982] [0.04608361]
|
||||
24 [-0.04414708] [0.04180121]
|
||||
25 [-0.04004464] [0.03791676]
|
||||
26 [-0.03632342] [0.03439327]
|
||||
27 [-0.032948] [0.03119722]
|
||||
28 [-0.02988625] [0.02829816]
|
||||
29 [-0.02710901] [0.0256685]
|
||||
theta from own gd
|
||||
[[3.9707256]
|
||||
[3.0251375]]
|
||||
0 [-0.01034877] [0.00888634]
|
||||
1 [-0.00948452] [0.00814422]
|
||||
2 [-0.00843317] [0.00724144]
|
||||
3 [-0.00741349] [0.00636586]
|
||||
4 [-0.00648847] [0.00557155]
|
||||
5 [-0.00566909] [0.00486797]
|
||||
6 [-0.00494984] [0.00425036]
|
||||
7 [-0.00432069] [0.00371011]
|
||||
8 [-0.00377111] [0.0032382]
|
||||
9 [-0.00329131] [0.0028262]
|
||||
10 [-0.0028725] [0.00246657]
|
||||
11 [-0.00250697] [0.0021527]
|
||||
12 [-0.00218794] [0.00187876]
|
||||
13 [-0.00190952] [0.00163967]
|
||||
14 [-0.00166652] [0.00143102]
|
||||
15 [-0.00145445] [0.00124891]
|
||||
16 [-0.00126936] [0.00108998]
|
||||
17 [-0.00110783] [0.00095127]
|
||||
18 [-0.00096685] [0.00083022]
|
||||
19 [-0.00084381] [0.00072457]
|
||||
20 [-0.00073643] [0.00063236]
|
||||
21 [-0.00064272] [0.00055189]
|
||||
22 [-0.00056093] [0.00048166]
|
||||
23 [-0.00048955] [0.00042037]
|
||||
24 [-0.00042725] [0.00036687]
|
||||
25 [-0.00037288] [0.00032019]
|
||||
26 [-0.00032543] [0.00027944]
|
||||
27 [-0.00028402] [0.00024388]
|
||||
28 [-0.00024787] [0.00021284]
|
||||
29 [-0.00021633] [0.00018576]
|
||||
[[3.93097189]
|
||||
[3.06536011]]
|
||||
0 [-0.02458986] [0.02328321]
|
||||
1 [-0.0223048] [0.02111958]
|
||||
2 [-0.01954657] [0.01850791]
|
||||
3 [-0.0169027] [0.01600453]
|
||||
4 [-0.01453883] [0.01376627]
|
||||
5 [-0.01247862] [0.01181553]
|
||||
6 [-0.01070096] [0.01013233]
|
||||
7 [-0.00917325] [0.00868581]
|
||||
8 [-0.0078625] [0.00744471]
|
||||
9 [-0.00673864] [0.00638056]
|
||||
10 [-0.00577528] [0.00546839]
|
||||
11 [-0.00494959] [0.00468658]
|
||||
12 [-0.00424194] [0.00401653]
|
||||
13 [-0.00363545] [0.00344227]
|
||||
14 [-0.00311567] [0.00295011]
|
||||
15 [-0.00267021] [0.00252832]
|
||||
16 [-0.00228844] [0.00216684]
|
||||
17 [-0.00196125] [0.00185703]
|
||||
18 [-0.00168084] [0.00159152]
|
||||
19 [-0.00144052] [0.00136398]
|
||||
20 [-0.00123456] [0.00116896]
|
||||
21 [-0.00105805] [0.00100183]
|
||||
22 [-0.00090678] [0.00085859]
|
||||
23 [-0.00077713] [0.00073584]
|
||||
24 [-0.00066602] [0.00063063]
|
||||
25 [-0.0005708] [0.00054047]
|
||||
26 [-0.00048919] [0.00046319]
|
||||
27 [-0.00041925] [0.00039697]
|
||||
28 [-0.0003593] [0.00034021]
|
||||
29 [-0.00030793] [0.00029157]
|
||||
theta from own gd wth momentum
|
||||
[[3.99946593]
|
||||
[3.0004586 ]]
|
||||
[[3.99925917]
|
||||
[3.00070146]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1144,17 +1149,17 @@ theta from own gd wth momentum
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.16849001]
|
||||
[3.03642937]]
|
||||
Eigenvalues of Hessian Matrix:[0.3039241 4.51493779]
|
||||
0 [-12.93402104] [-15.39497785]
|
||||
1 [9.11944131e-15] [7.63687445e-15]
|
||||
2 [2.11636264e-16] [3.19670115e-16]
|
||||
3 [2.11636264e-16] [3.19670115e-16]
|
||||
4 [2.11636264e-16] [3.19670115e-16]
|
||||
[[3.86751196]
|
||||
[3.13877544]]
|
||||
Eigenvalues of Hessian Matrix:[0.29322629 4.30627615]
|
||||
0 [-14.05912765] [-16.736807]
|
||||
1 [-2.16077156e-14] [-1.19631285e-14]
|
||||
2 [-1.70002901e-16] [-1.23687362e-16]
|
||||
3 [-1.70002901e-16] [-1.23687362e-16]
|
||||
4 [-1.70002901e-16] [-1.23687362e-16]
|
||||
beta from own Newton code
|
||||
[[4.16849001]
|
||||
[3.03642937]]
|
||||
[[3.86751196]
|
||||
[3.13877544]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1243,20 +1248,22 @@ beta from own Newton code
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.37133465]
|
||||
[2.74809387]]
|
||||
Eigenvalues of Hessian Matrix:[0.32760411 4.2384333 ]
|
||||
[[3.90340018]
|
||||
[3.20732292]]
|
||||
Eigenvalues of Hessian Matrix:[0.30252911 4.09446058]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
[[4.37133465]
|
||||
[2.74809387]]
|
||||
[[3.90340018]
|
||||
[3.20732292]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_22_2.png" src="_images/exercisesweek41_22_2.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
|
||||
[[4.31985268]
|
||||
[2.72067593]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[3.86364839]
|
||||
[3.23799188]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1338,15 +1345,15 @@ Eigenvalues of Hessian Matrix:[0.32760411 4.2384333 ]
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.34039341]
|
||||
[2.74045887]]
|
||||
Eigenvalues of Hessian Matrix:[0.31262618 4.15129596]
|
||||
[[4.38463079]
|
||||
[2.57169626]]
|
||||
Eigenvalues of Hessian Matrix:[0.27355018 4.06502525]
|
||||
theta from own gd
|
||||
[[4.340226 ]
|
||||
[2.74060714]]
|
||||
[[4.38343773]
|
||||
[2.57278714]]
|
||||
theta from own sdg with momentum
|
||||
[[4.30982672]
|
||||
[2.69332574]]
|
||||
[[4.35254442]
|
||||
[2.58244397]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1421,9 +1428,9 @@ theta from own sdg with momentum
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own AdaGrad
|
||||
[[2.0009282 ]
|
||||
[2.99447213]
|
||||
[4.00526145]]
|
||||
[[2.0000375 ]
|
||||
[2.99981967]
|
||||
[4.00017395]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1505,9 +1512,9 @@ theta from own sdg with momentum
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own RMSprop
|
||||
[[1.99998409]
|
||||
[2.99993515]
|
||||
[4.00003694]]
|
||||
[[1.99998686]
|
||||
[2.9995237 ]
|
||||
[4.00046845]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1593,9 +1600,9 @@ theta from own sdg with momentum
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own ADAM
|
||||
[[2.00011851]
|
||||
[2.99937234]
|
||||
[4.00068042]]
|
||||
[[1.99990776]
|
||||
[3.0005044 ]
|
||||
[3.99956442]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1668,7 +1675,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
|
||||
return asarray(x, dtype=self.dtype)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x125606520>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x11edfa8b0>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_39_2.png" src="_images/exercisesweek41_39_2.png" />
|
||||
@@ -1703,7 +1710,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x1253cc610>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x11ef1aac0>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_41_1.png" src="_images/exercisesweek41_41_1.png" />
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -55,7 +55,7 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Project 1 on Machine Learning, deadline October 7 (midnight), 2024" href="project1.html" />
|
||||
<link rel="next" title="Week 44, Convolutional Neural Networks (CNN)" href="week44.html" />
|
||||
<link rel="prev" title="Week 43: Deep Learning: Constructing a Neural Network code and solving differential equations" href="week43.html" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="docsearch:language" content="None">
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1132,10 +1137,10 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
<p class="prev-next-title">Week 43: Deep Learning: Constructing a Neural Network code and solving differential equations</p>
|
||||
</div>
|
||||
</a>
|
||||
<a class='right-next' id="next-link" href="project1.html" title="next page">
|
||||
<a class='right-next' id="next-link" href="week44.html" title="next page">
|
||||
<div class="prev-next-info">
|
||||
<p class="prev-next-subtitle">next</p>
|
||||
<p class="prev-next-title">Project 1 on Machine Learning, deadline October 7 (midnight), 2024</p>
|
||||
<p class="prev-next-title">Week 44, Convolutional Neural Networks (CNN)</p>
|
||||
</div>
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -344,6 +344,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -345,6 +345,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -668,8 +673,8 @@ matrices and vectors.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.08059005 0.26043697 0.54190252 -0.8321864 1.74960664 0.28855565
|
||||
1.03029311 -0.54136139 0.94583038 0.99378218]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 0.32001824 -0.74192227 0.29589074 0.79474214 0.93002171 -0.3039884
|
||||
-0.23453753 0.42163714 0.38469469 -0.16425426]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -890,26 +895,26 @@ as (recall that we user lowercase letters for vectors and uppercase letters for
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.77235007 0.27529208 0.31199504 0.17293829 0.82162246 0.13378194
|
||||
0.90679215 0.39664124 0.3121824 0.13861839]
|
||||
[0.69473608 0.72612916 0.4570065 0.41275555 0.76067335 0.56239325
|
||||
0.33900003 0.83105136 0.14230327 0.04713857]
|
||||
[0.62377027 0.12392385 0.7500676 0.67969567 0.15971479 0.97072608
|
||||
0.00183119 0.95291169 0.59353543 0.03550103]
|
||||
[0.99152919 0.13537597 0.88366546 0.73118203 0.82120582 0.53939154
|
||||
0.01958776 0.59647764 0.17941609 0.34647125]
|
||||
[0.43263402 0.2754374 0.59137018 0.52019078 0.71121535 0.60648493
|
||||
0.94665557 0.66298436 0.22615136 0.29639686]
|
||||
[0.84424529 0.59603845 0.9219476 0.44909201 0.67715931 0.18908167
|
||||
0.76516101 0.38007856 0.83478186 0.75271427]
|
||||
[0.53862422 0.11323706 0.15316333 0.34540564 0.81994631 0.52292446
|
||||
0.26760957 0.02430273 0.03576146 0.67801091]
|
||||
[0.52928925 0.14990609 0.86292532 0.43014974 0.83844809 0.04560463
|
||||
0.84163178 0.80868063 0.8371938 0.39611129]
|
||||
[0.12607006 0.5113303 0.63901709 0.99976659 0.34756595 0.28622513
|
||||
0.89290901 0.84314251 0.31916189 0.29920799]
|
||||
[0.23476091 0.40074419 0.21933245 0.48906993 0.19899282 0.06752501
|
||||
0.85079729 0.64275853 0.33164051 0.08304321]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.82195744 0.3891388 0.6393255 0.23848657 0.94055712 0.09024338
|
||||
0.37413588 0.74761567 0.35435219 0.07518155]
|
||||
[0.38479849 0.78036158 0.21824173 0.13664315 0.21480211 0.52460926
|
||||
0.89595918 0.25702102 0.46918325 0.00800661]
|
||||
[0.48745365 0.65375675 0.41048039 0.738242 0.68043741 0.42684131
|
||||
0.68546404 0.40826579 0.52793214 0.7031337 ]
|
||||
[0.07395645 0.49563003 0.53379115 0.81702472 0.00841458 0.72858608
|
||||
0.30840554 0.47836061 0.2180387 0.45175115]
|
||||
[0.36057178 0.55188499 0.48122761 0.1403625 0.56938055 0.04170341
|
||||
0.81077908 0.74066856 0.87234539 0.77231525]
|
||||
[0.4271294 0.25172651 0.83065295 0.37772591 0.79299228 0.80941284
|
||||
0.51579138 0.45860296 0.80070169 0.07136868]
|
||||
[0.00355788 0.63534832 0.84438755 0.30356855 0.20488577 0.24956991
|
||||
0.06192181 0.42523073 0.09314326 0.14371995]
|
||||
[0.74985547 0.10252946 0.3477494 0.32907268 0.41745457 0.38472307
|
||||
0.16382994 0.55656086 0.84104054 0.03111555]
|
||||
[0.83749554 0.84073416 0.69347409 0.82022408 0.04823618 0.34401751
|
||||
0.72546035 0.60205311 0.22177506 0.58325333]
|
||||
[0.30521597 0.84357837 0.8955058 0.17549914 0.96618572 0.86987923
|
||||
0.03103759 0.44019341 0.30819287 0.07016861]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -969,13 +974,13 @@ 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.04071979724729911
|
||||
4.064820972167253
|
||||
-0.3254718508870977
|
||||
[[0.88727586 2.57584621 2.19767225]
|
||||
[2.57584621 8.44132765 6.34964801]
|
||||
[2.19767225 6.34964801 9.99322469]]
|
||||
[16.34233281 0.08212093 2.89737445]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.0005546012958340718
|
||||
4.201607904119753
|
||||
-0.10755063024965804
|
||||
[[ 1.0024984 3.08394521 3.01944109]
|
||||
[ 3.08394521 10.46598005 8.68420144]
|
||||
[ 3.01944109 8.68420144 13.58893352]]
|
||||
[21.74071459 0.05707756 3.25961982]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="Project 2 on Machine Learning, deadline November 4 (Midnight)" href="project2.html" />
|
||||
<link rel="prev" title="Exercises week 43" href="exercisesweek43.html" />
|
||||
<link rel="prev" title="Week 44, Convolutional Neural Networks (CNN)" href="week44.html" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="docsearch:language" content="None">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1094,11 +1099,11 @@ of code developers and contributors keeps increasing.</p>
|
||||
|
||||
<!-- Previous / next buttons -->
|
||||
<div class='prev-next-area'>
|
||||
<a class='left-prev' id="prev-link" href="exercisesweek43.html" title="previous page">
|
||||
<a class='left-prev' id="prev-link" href="week44.html" title="previous page">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
<div class="prev-next-info">
|
||||
<p class="prev-next-subtitle">previous</p>
|
||||
<p class="prev-next-title">Exercises week 43</p>
|
||||
<p class="prev-next-title">Week 44, Convolutional Neural Networks (CNN)</p>
|
||||
</div>
|
||||
</a>
|
||||
<a class='right-next' id="next-link" href="project2.html" title="next page">
|
||||
|
||||
@@ -347,6 +347,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -346,6 +346,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -350,6 +350,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1040,27 +1045,27 @@ uncorrelated.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>1.792442235218746
|
||||
[[ 2.10296919 4.21086655 4.66575943 7.88378851 6.35849734 4.4257124
|
||||
3.96306539 0.81366409 3.49568351 5.17399603]
|
||||
[ 4.21086655 8.43160097 9.34245275 15.78605212 12.73189536 8.86179614
|
||||
7.93541793 1.62923495 6.9995589 10.36011695]
|
||||
[ 4.66575943 9.34245275 10.35170232 17.49139298 14.10730076 9.81912119
|
||||
8.79266789 1.80523848 7.75570956 11.4793031 ]
|
||||
[ 7.88378851 15.78605212 17.49139298 29.55541212 23.83727177 16.59148438
|
||||
14.85707419 3.05033266 13.10491353 19.39671325]
|
||||
[ 6.35849734 12.73189536 14.10730076 23.83727177 19.22543063 13.38149915
|
||||
11.98264851 2.46017915 10.56948162 15.64399519]
|
||||
[ 4.4257124 8.86179614 9.81912119 16.59148438 13.38149915 9.31394064
|
||||
8.34029698 1.71236139 7.35668876 10.88870842]
|
||||
[ 3.96306539 7.93541793 8.79266789 14.85707419 11.98264851 8.34029698
|
||||
7.46843429 1.5333577 6.58764871 9.75044457]
|
||||
[ 0.81366409 1.62923495 1.80523848 3.05033266 2.46017915 1.71236139
|
||||
1.5333577 0.31481643 1.35252202 2.00188134]
|
||||
[ 3.49568351 6.9995589 7.75570956 13.10491353 10.56948162 7.35668876
|
||||
6.58764871 1.35252202 5.81073808 8.60053139]
|
||||
[ 5.17399603 10.36011695 11.4793031 19.39671325 15.64399519 10.88870842
|
||||
9.75044457 2.00188134 8.60053139 12.72973232]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2.0607697355132246
|
||||
[[ 4.55115556 10.33932482 8.1013878 7.00335444 8.25896648 12.4484389
|
||||
5.43771659 2.97702119 1.56381399 8.22843017]
|
||||
[10.33932482 23.48889999 18.40474994 15.91023542 18.76273751 28.28038982
|
||||
12.35341606 6.76320304 3.55267592 18.69336507]
|
||||
[ 8.1013878 18.40474994 14.42105932 12.4664801 14.70156083 22.15912635
|
||||
9.67953091 5.29931417 2.7837026 14.64720399]
|
||||
[ 7.00335444 15.91023542 12.4664801 10.77681762 12.70896343 19.15575698
|
||||
8.36760163 4.58106393 2.40640942 12.66197393]
|
||||
[ 8.25896648 18.76273751 14.70156083 12.70896343 14.98751832 22.59013965
|
||||
9.86780577 5.40239021 2.83784791 14.9321042 ]
|
||||
[12.4484389 28.28038982 22.15912635 19.15575698 22.59013965 34.04929344
|
||||
14.87338368 8.14282569 4.27738464 22.50661596]
|
||||
[ 5.43771659 12.35341606 9.67953091 8.36760163 9.86780577 14.87338368
|
||||
6.49697893 3.55694226 1.86844355 9.83132102]
|
||||
[ 2.97702119 6.76320304 5.29931417 4.58106393 5.40239021 8.14282569
|
||||
3.55694226 1.94734174 1.02292864 5.38241567]
|
||||
[ 1.56381399 3.55267592 2.7837026 2.40640942 2.83784791 4.27738464
|
||||
1.86844355 1.02292864 0.53733918 2.82735539]
|
||||
[ 8.22843017 18.69336507 14.64720399 12.66197393 14.9321042 22.50661596
|
||||
9.83132102 5.38241567 2.82735539 14.87689496]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1328,15 +1333,15 @@ more practically oriented methods like the blocking technique.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.03309100631504689
|
||||
4.053690173865474
|
||||
0.19676409012950763
|
||||
0.9238126238237127 9.751549347323406 13.02381502730822
|
||||
2.8153623169095896 2.4608605587175947 7.2634338084990535
|
||||
[[ 0.92381262 2.81536232 2.46086056]
|
||||
[ 2.81536232 9.75154935 7.26343381]
|
||||
[ 2.46086056 7.26343381 13.02381503]]
|
||||
[19.56094738 0.08771271 4.05051691]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07625077951488718
|
||||
4.3560752281211315
|
||||
-0.3306482154344632
|
||||
1.1590181727490236 13.220435343291307 24.380661549395565
|
||||
3.788773381830552 4.089069393266692 13.299354039977322
|
||||
[[ 1.15901817 3.78877338 4.08906939]
|
||||
[ 3.78877338 13.22043534 13.29935404]
|
||||
[ 4.08906939 13.29935404 24.38066155]]
|
||||
[34.14195011 0.06190305 4.55626191]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1666,7 +1671,7 @@ assumption for approximating <span class="math notranslate nohighlight">\(\sigma
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.01754817104095514 0.9184060613261256
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.007840665517467031 0.9968742237157096
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/statistics_188_1.png" src="_images/statistics_188_1.png" />
|
||||
|
||||
@@ -346,6 +346,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -346,6 +346,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1728,8 +1733,8 @@ developed in the 1970s, namely EISPACK and LINPACK. We describe them shortly he
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.44898476 0.65543958 -0.19009894 -1.54003127 0.54908576 1.22268225
|
||||
0.85101172 -0.07094607 0.31613828 2.01311197]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.23735423 -0.34348527 -0.45751302 -0.40762065 0.81063784 -1.91668429
|
||||
0.84661055 0.10685672 -0.72237094 0.95928891]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1954,26 +1959,26 @@ lowercase letters for vectors and uppercase letters for matrices)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.07297544 0.1366929 0.25398681 0.35559575 0.59290535 0.27121997
|
||||
0.13195623 0.10766611 0.92510128 0.09590878]
|
||||
[0.49781325 0.85327004 0.44122101 0.54419365 0.27783579 0.75720786
|
||||
0.59926703 0.31297469 0.46106755 0.95745534]
|
||||
[0.92393165 0.11004595 0.47187607 0.67191313 0.66545999 0.05772472
|
||||
0.82838817 0.45380039 0.95432881 0.5961356 ]
|
||||
[0.31723049 0.28868604 0.85458026 0.47874964 0.98191653 0.82894855
|
||||
0.78875722 0.15102593 0.82009906 0.65700779]
|
||||
[0.65533829 0.16452848 0.99858871 0.98654578 0.29760523 0.49945378
|
||||
0.01910339 0.58642686 0.67898825 0.25439747]
|
||||
[0.36573968 0.77838912 0.28065817 0.93388517 0.91321225 0.73880347
|
||||
0.48253511 0.51439255 0.72062943 0.69400286]
|
||||
[0.43445446 0.39467981 0.97900469 0.85944866 0.73824262 0.88071254
|
||||
0.11731667 0.9080271 0.71921281 0.90150448]
|
||||
[0.33085218 0.56245497 0.21046538 0.11038556 0.85669407 0.10200001
|
||||
0.47302573 0.00922097 0.36991768 0.65854722]
|
||||
[0.89515649 0.78939263 0.25828869 0.86260982 0.74693983 0.04328411
|
||||
0.01427038 0.14780956 0.07962663 0.39707815]
|
||||
[0.18461559 0.69297058 0.68332496 0.79758524 0.22346703 0.48744228
|
||||
0.50987248 0.04777426 0.15961465 0.20041381]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.32314762 0.18808732 0.73055654 0.39680105 0.02304094 0.25217356
|
||||
0.129859 0.64795609 0.64050858 0.41326961]
|
||||
[0.11763276 0.49589995 0.61608406 0.942561 0.42563188 0.26590047
|
||||
0.36366153 0.0110055 0.80283501 0.57112844]
|
||||
[0.17037235 0.25878575 0.66933663 0.4648587 0.32102563 0.28258385
|
||||
0.88952612 0.32433563 0.20378128 0.07772209]
|
||||
[0.4991256 0.9062501 0.68396922 0.53225748 0.50193981 0.70953125
|
||||
0.16772744 0.90167436 0.0375156 0.90055798]
|
||||
[0.39834827 0.10692529 0.48555675 0.24736739 0.42480583 0.13714577
|
||||
0.72496896 0.31602127 0.5101314 0.90050507]
|
||||
[0.9494619 0.45669779 0.1510965 0.06679734 0.5955051 0.08050628
|
||||
0.90783944 0.72596005 0.47331396 0.0422287 ]
|
||||
[0.53851415 0.91315101 0.81556283 0.5664958 0.02538656 0.66160323
|
||||
0.99622734 0.27745486 0.40313394 0.14359337]
|
||||
[0.83853982 0.5523202 0.37501385 0.15553205 0.86789195 0.52184321
|
||||
0.30855785 0.93413623 0.84687351 0.54874291]
|
||||
[0.32402196 0.77986982 0.80692881 0.33091173 0.82391536 0.22779081
|
||||
0.78403064 0.14537136 0.28668988 0.89211729]
|
||||
[0.39499333 0.52319188 0.27585199 0.26939658 0.25115372 0.44987974
|
||||
0.25033611 0.74689928 0.48346049 0.16742049]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2028,13 +2033,13 @@ 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.09941804358942685
|
||||
4.135553999655979
|
||||
0.06128276434886384
|
||||
[[ 0.81985155 2.4736645 2.12220773]
|
||||
[ 2.4736645 8.54371074 6.81973052]
|
||||
[ 2.12220773 6.81973052 10.51290787]]
|
||||
[17.05928882 0.09257332 2.72460802]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.15835300124337048
|
||||
3.5560614852167705
|
||||
-0.259533893783188
|
||||
[[0.86807326 2.60292037 1.96983721]
|
||||
[2.60292037 8.73386494 5.86802297]
|
||||
[1.96983721 5.86802297 7.50911947]]
|
||||
[14.78194038 0.0734671 2.25565019]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2259,7 +2264,7 @@ Name: Aragorn, dtype: object
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
|
||||
<span class="ne">AttributeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
|
||||
<span class="nn">/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94272/1326197715.py</span> in <span class="ni">?</span><span class="nt">()</span>
|
||||
<span class="nn">/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20912/1326197715.py</span> in <span class="ni">?</span><span class="nt">()</span>
|
||||
<span class="ne">----> </span><span class="mi">6</span> <span class="n">new_hobbit</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'First Name'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Peregrin"</span><span class="p">],</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">7</span> <span class="s1">'Last Name'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Took"</span><span class="p">],</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">8</span> <span class="s1">'Place of birth'</span><span class="p">:</span> <span class="p">[</span><span class="s2">"Shire"</span><span class="p">],</span>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1696,7 +1701,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.9951746722640107
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9960309859796598
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1713,7 +1718,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.011011355570628998
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.009724998242604404
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1728,23 +1733,23 @@ 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.04642309 0.0279278 0.0228686 0.0650014 0.01290661 0.01519201
|
||||
0.0016396 0.05684345 0.06249397 0.00778835 0.00518242 0.02159357
|
||||
0.00421124 0.01267244 0.02280587 0.00184147 0.07626658 0.02041607
|
||||
0.03238421 0.02937931 0.04215521 0.03179975 0.00508636 0.04983222
|
||||
0.0705828 0.00555576 0.02882718 0.00046916 0.00861192 0.04145287
|
||||
0.02255993 0.00567103 0.02731257 0.02307403 0.02643023 0.03374269
|
||||
0.02728257 0.00045414 0.01269348 0.01433606 0.0031986 0.00813523
|
||||
0.01677512 0.02132304 0.02971554 0.02671209 0.03110579 0.00701382
|
||||
0.0281646 0.01167316 0.00049905 0.01368052 0.01667926 0.00935737
|
||||
0.02496143 0.08648837 0.01394224 0.04394742 0.00582904 0.06185995
|
||||
0.03162926 0.05276967 0.01028953 0.05735741 0.01571214 0.02287532
|
||||
0.01947663 0.00861563 0.00414684 0.00858857 0.0036035 0.00523549
|
||||
0.01608796 0.03520118 0.02959231 0.00068056 0.02717123 0.02989838
|
||||
0.01203668 0.02622061 0.0109944 0.09258408 0.03607387 0.01775486
|
||||
0.08931681 0.00514007 0.03450725 0.03465317 0.01712306 0.00757359
|
||||
0.02069038 0.02243626 0.01508864 0.03202289 0.06776056 0.01054406
|
||||
0.0169931 0.01784495 0.00962196 0.03370657]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.04358642 0.01141029 0.0435614 0.00703349 0.05933848 0.04644334
|
||||
0.00355583 0.04946218 0.06473841 0.01522194 0.02492839 0.01331377
|
||||
0.03460821 0.04249722 0.03803121 0.01330851 0.0209366 0.04740225
|
||||
0.01287575 0.02432892 0.0212243 0.02026696 0.01956208 0.06172974
|
||||
0.00781304 0.02535601 0.02299139 0.00642673 0.06636179 0.01543463
|
||||
0.00485699 0.04007138 0.01269131 0.01207585 0.05093545 0.10440237
|
||||
0.05140098 0.04050007 0.00041514 0.01136346 0.01146165 0.00545269
|
||||
0.02308971 0.06033348 0.05777676 0.01621264 0.03982843 0.00664787
|
||||
0.04863731 0.02324012 0.08188888 0.00918064 0.01879279 0.00590621
|
||||
0.01493602 0.02972907 0.02201916 0.01724416 0.00774514 0.02101997
|
||||
0.00960705 0.02180068 0.00078941 0.00684494 0.00135206 0.00448
|
||||
0.02412606 0.00767649 0.10848476 0.00013622 0.04684669 0.03330946
|
||||
0.02565627 0.01196444 0.02901384 0.01765696 0.00550901 0.00408609
|
||||
0.01399696 0.00851785 0.01518425 0.01147217 0.03078393 0.02034322
|
||||
0.03762405 0.07153605 0.00778706 0.02160067 0.00577307 0.02272294
|
||||
0.06726755 0.00914684 0.02512704 0.0452313 0.01120918 0.00652804
|
||||
0.02085067 0.02378634 0.02560435 0.01323492]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1813,15 +1818,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.99804178 -0.16533342 5.68321093 -0.84401704 0.35781308]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 2.014896 -0.32009434 6.3804687 -1.81093622 0.74663164]
|
||||
Training R2
|
||||
0.9960664320362111
|
||||
0.9955259363342327
|
||||
Training MSE
|
||||
0.008377169630073601
|
||||
0.00915723745398148
|
||||
Test R2
|
||||
0.9944299733827195
|
||||
0.9941130198635889
|
||||
Test MSE
|
||||
0.01282028141098116
|
||||
0.009410131112671444
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1684,7 +1689,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.052 15.0095 100.051 0.150055
|
||||
99.9722 14.9105 99.9697 0.149904
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1926,9 +1931,7 @@ Error: 0.05227921801205686
|
||||
Bias^2: 0.0481872773043029
|
||||
Var: 0.004091940707753939
|
||||
0.05227921801205686 >= 0.0481872773043029 + 0.004091940707753939 = 0.052279218012056844
|
||||
</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.037813671417389005
|
||||
Bias^2: 0.033657685071527665
|
||||
Var: 0.00415598634586135
|
||||
@@ -1960,21 +1963,21 @@ Error: 0.07160048164233104
|
||||
Bias^2: 0.014436800088904942
|
||||
Var: 0.05716368155342608
|
||||
0.07160048164233104 >= 0.014436800088904942 + 0.05716368155342608 = 0.07160048164233102
|
||||
Polynomial degree: 12
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 12
|
||||
Error: 0.11547777218872497
|
||||
Bias^2: 0.01628578269596628
|
||||
Var: 0.09919198949275869
|
||||
0.11547777218872497 >= 0.01628578269596628 + 0.09919198949275869 = 0.11547777218872497
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 13
|
||||
Polynomial degree: 13
|
||||
Error: 0.22842468702219465
|
||||
Bias^2: 0.01975416527185249
|
||||
Var: 0.20867052175034223
|
||||
0.22842468702219465 >= 0.01975416527185249 + 0.20867052175034223 = 0.2284246870221947
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week37_139_5.png" src="_images/week37_139_5.png" />
|
||||
<img alt="_images/week37_139_4.png" src="_images/week37_139_4.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2311,12 +2314,12 @@ Mean squared error on test data: 129963.83146596
|
||||
Degree of polynomial: 3
|
||||
Mean squared error on training data: 9054.61775176
|
||||
Mean squared error on test data: 10572.87627342
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 4
|
||||
Degree of polynomial: 4
|
||||
Mean squared error on training data: 302.15313054
|
||||
Mean squared error on test data: 433.26292364
|
||||
Degree of polynomial: 5
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 5
|
||||
Mean squared error on training data: 3.64316192
|
||||
Mean squared error on test data: 7.23528337
|
||||
Degree of polynomial: 6
|
||||
@@ -2325,12 +2328,12 @@ 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
|
||||
@@ -2339,12 +2342,12 @@ Mean squared error on test data: 0.22467274
|
||||
Degree of polynomial: 11
|
||||
Mean squared error on training data: 0.01594452
|
||||
Mean squared error on test data: 1.07641937
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 12
|
||||
Degree of polynomial: 12
|
||||
Mean squared error on training data: 0.00805074
|
||||
Mean squared error on test data: 0.04295757
|
||||
Degree of polynomial: 13
|
||||
</pre></div>
|
||||
</div>
|
||||
<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
|
||||
@@ -2353,12 +2356,12 @@ Mean squared error on test data: 0.28443039
|
||||
Degree of polynomial: 15
|
||||
Mean squared error on training data: 0.00420072
|
||||
Mean squared error on test data: 568.47051432
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 16
|
||||
Degree of polynomial: 16
|
||||
Mean squared error on training data: 0.00325450
|
||||
Mean squared error on test data: 48.97630233
|
||||
Degree of polynomial: 17
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 17
|
||||
Mean squared error on training data: 0.00242954
|
||||
Mean squared error on test data: 2.52780600
|
||||
Degree of polynomial: 18
|
||||
@@ -2367,12 +2370,12 @@ 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
|
||||
@@ -2381,12 +2384,12 @@ Mean squared error on test data: 1184.60929685
|
||||
Degree of polynomial: 23
|
||||
Mean squared error on training data: 0.00089193
|
||||
Mean squared error on test data: 3892.17483760
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 24
|
||||
Degree of polynomial: 24
|
||||
Mean squared error on training data: 0.00083355
|
||||
Mean squared error on test data: 1332.46736215
|
||||
Degree of polynomial: 25
|
||||
</pre></div>
|
||||
</div>
|
||||
<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
|
||||
@@ -2395,19 +2398,19 @@ Mean squared error on test data: 1079.36895644
|
||||
Degree of polynomial: 27
|
||||
Mean squared error on training data: 0.00068091
|
||||
Mean squared error on test data: 3207.25343155
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 28
|
||||
Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00063362
|
||||
Mean squared error on test data: 674.79633065
|
||||
Degree of polynomial: 29
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 29
|
||||
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_94293/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_20933/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_94293/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20933/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2492,7 +2495,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_94293/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_20933/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1827,7 +1832,7 @@ which equals</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><mpl_toolkits.mplot3d.art3d.Poly3DCollection at 0x1220ecf70>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><mpl_toolkits.mplot3d.art3d.Poly3DCollection at 0x120b67a60>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_82_1.png" src="_images/week39_82_1.png" />
|
||||
@@ -1885,7 +1890,7 @@ which equals</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x122eac100>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x1213d5ee0>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_90_1.png" src="_images/week39_90_1.png" />
|
||||
@@ -2179,11 +2184,11 @@ when <span class="math notranslate nohighlight">\(||\nabla_\beta C(\beta_k) || \
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.2823954 4.41825413]
|
||||
[[3.80708727]
|
||||
[3.19057517]]
|
||||
[[3.80708727]
|
||||
[3.19057517]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.31492096 4.28033995]
|
||||
[[3.6006178 ]
|
||||
[3.29753883]]
|
||||
[[3.6006178 ]
|
||||
[3.29753883]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_153_1.png" src="_images/week39_153_1.png" />
|
||||
@@ -2214,9 +2219,9 @@ when <span class="math notranslate nohighlight">\(||\nabla_\beta C(\beta_k) || \
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[3.93061247]
|
||||
[3.05485826]]
|
||||
[3.94361404] [3.09345236]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[3.87513212]
|
||||
[3.12510307]]
|
||||
[3.90280702] [3.15433894]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2316,11 +2321,11 @@ minimum of this function.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.28261591 4.24106633]
|
||||
[[4.11425439]
|
||||
[2.70819495]]
|
||||
[[4.11313433]
|
||||
[2.70917646]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.28372329 4.0956114 ]
|
||||
[[3.8980893 ]
|
||||
[3.08479726]]
|
||||
[[3.89868561]
|
||||
[3.08425705]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_166_1.png" src="_images/week39_166_1.png" />
|
||||
@@ -2434,7 +2439,7 @@ minimum of this function.</p>
|
||||
>29 f([0.00115631]) = 0.00000
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94310/394505933.py:33: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20948/394505933.py:33: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
|
||||
print('>%d f(%s) = %.5f' % (i, solution, solution_eval))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2545,7 +2550,7 @@ minimum of this function.</p>
|
||||
>29 f([6.17748881e-07]) = 0.00000
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_94310/476849792.py:39: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20948/476849792.py:39: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
|
||||
print('>%d f(%s) = %.5f' % (i, solution, solution_eval))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3607,14 +3612,12 @@ first example shows results with ordinary leats squares.</p>
|
||||
[[3.94499279]
|
||||
[3.03306538]]
|
||||
Eigenvalues of Hessian Matrix:[0.31248425 4.44418124]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
theta from own gd
|
||||
[[3.94499279]
|
||||
[3.03306538]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_263_2.png" src="_images/week39_263_2.png" />
|
||||
<img alt="_images/week39_263_1.png" src="_images/week39_263_1.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3903,14 +3906,12 @@ beta from own Newton code
|
||||
[[4.0586484]
|
||||
[3.0718316]]
|
||||
Eigenvalues of Hessian Matrix:[0.29860173 3.8931686 ]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
theta from own gd
|
||||
[[4.0586484]
|
||||
[3.0718316]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_269_2.png" src="_images/week39_269_2.png" />
|
||||
<img alt="_images/week39_269_1.png" src="_images/week39_269_1.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
|
||||
</pre></div>
|
||||
</div>
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1329,17 +1334,17 @@ We summarize some of these here for the methods we hvae studied in project one,
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Parameters for OLS using gradient descent
|
||||
[[3.79341574]
|
||||
[3.45532899]
|
||||
[4.79869224]]
|
||||
[[3.52649344]
|
||||
[4.28384131]
|
||||
[4.39301381]]
|
||||
Parameters for Ridge using gradient descent
|
||||
[[3.66467908]
|
||||
[3.67744448]
|
||||
[4.69668411]]
|
||||
[[3.85580661]
|
||||
[3.22264403]
|
||||
[4.90636879]]
|
||||
Parameters for Lasso using gradient descent
|
||||
[[3.8936154 ]
|
||||
[3.05785843]
|
||||
[5.01267038]]
|
||||
[[3.48209228]
|
||||
[4.41003194]
|
||||
[4.32994479]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1391,11 +1396,11 @@ Parameters for Lasso using gradient descent
|
||||
[[4.]
|
||||
[3.]
|
||||
[5.]]
|
||||
0 [-28.98027789] [-37.42420721]
|
||||
1 [1.31983313e-14] [3.4924028e-14]
|
||||
2 [7.99360578e-16] [9.55743376e-16]
|
||||
3 [-1.42108547e-16] [-2.57209333e-16]
|
||||
4 [-1.59872116e-16] [6.89684207e-17]
|
||||
0 [-27.32010544] [-38.1343232]
|
||||
1 [-8.47855119e-14] [-7.94623681e-14]
|
||||
2 [-8.17124146e-16] [-1.01009372e-15]
|
||||
3 [-7.28306304e-16] [-1.47279537e-15]
|
||||
4 [-8.17124146e-16] [-1.01009372e-15]
|
||||
beta from own Newton code
|
||||
[[4.]
|
||||
[3.]
|
||||
@@ -1737,15 +1742,15 @@ function.</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[3.8125468]
|
||||
[3.3410149]]
|
||||
Eigenvalues of Hessian Matrix:[0.30966921 4.24520733]
|
||||
[[3.97648396]
|
||||
[3.02497282]]
|
||||
Eigenvalues of Hessian Matrix:[0.33604933 4.1740886 ]
|
||||
theta from own gd
|
||||
[[3.8125468]
|
||||
[3.3410149]]
|
||||
[[3.97648396]
|
||||
[3.02497282]]
|
||||
theta from own sdg
|
||||
[[3.76103892]
|
||||
[3.31388878]]
|
||||
[[3.93398716]
|
||||
[3.06433206]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_34_1.png" src="_images/week40_34_1.png" />
|
||||
@@ -2459,12 +2464,12 @@ first example shows results with ordinary leats squares.</p>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.14040757]
|
||||
[2.84482599]]
|
||||
Eigenvalues of Hessian Matrix:[0.29095968 3.92422684]
|
||||
[[4.12726334]
|
||||
[2.9658822 ]]
|
||||
Eigenvalues of Hessian Matrix:[0.31252573 4.38126738]
|
||||
theta from own gd
|
||||
[[4.14040757]
|
||||
[2.84482599]]
|
||||
[[4.12726334]
|
||||
[2.9658822 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_100_1.png" src="_images/week40_100_1.png" />
|
||||
@@ -2535,73 +2540,76 @@ theta from own gd
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.]
|
||||
[3.]]
|
||||
Eigenvalues of Hessian Matrix:[0.28379561 4.4050219 ]
|
||||
0 [-10.19786399] [-11.56308108]
|
||||
1 [-0.23478113] [0.19832989]
|
||||
2 [-0.21965525] [0.1855524]
|
||||
3 [-0.20550386] [0.1735981]
|
||||
4 [-0.19226417] [0.16241396]
|
||||
5 [-0.17987746] [0.15195036]
|
||||
6 [-0.16828877] [0.14216089]
|
||||
7 [-0.15744669] [0.13300211]
|
||||
8 [-0.14730311] [0.12443338]
|
||||
9 [-0.13781304] [0.1164167]
|
||||
10 [-0.12893437] [0.1089165]
|
||||
11 [-0.12062771] [0.10189951]
|
||||
12 [-0.11285621] [0.09533458]
|
||||
13 [-0.1055854] [0.08919261]
|
||||
14 [-0.09878301] [0.08344633]
|
||||
15 [-0.09241887] [0.07807026]
|
||||
16 [-0.08646474] [0.07304055]
|
||||
17 [-0.08089421] [0.06833488]
|
||||
18 [-0.07568256] [0.06393237]
|
||||
19 [-0.07080668] [0.0598135]
|
||||
20 [-0.06624492] [0.05595998]
|
||||
21 [-0.06197706] [0.05235474]
|
||||
22 [-0.05798416] [0.04898176]
|
||||
23 [-0.0542485] [0.04582608]
|
||||
24 [-0.05075352] [0.04287372]
|
||||
25 [-0.0474837] [0.04011156]
|
||||
26 [-0.04442454] [0.03752735]
|
||||
27 [-0.04156247] [0.03510963]
|
||||
28 [-0.03888479] [0.03284768]
|
||||
29 [-0.03637961] [0.03073145]
|
||||
Eigenvalues of Hessian Matrix:[0.28925252 4.30058147]
|
||||
0 [-11.3166934] [-13.25217117]
|
||||
1 [0.05941571] [-0.05123603]
|
||||
2 [0.05541947] [-0.04778995]
|
||||
3 [0.05169202] [-0.04457564]
|
||||
4 [0.04821527] [-0.04157753]
|
||||
5 [0.04497236] [-0.03878107]
|
||||
6 [0.04194757] [-0.0361727]
|
||||
7 [0.03912622] [-0.03373976]
|
||||
8 [0.03649463] [-0.03147046]
|
||||
9 [0.03404004] [-0.02935379]
|
||||
10 [0.03175054] [-0.02737949]
|
||||
11 [0.02961504] [-0.02553797]
|
||||
12 [0.02762316] [-0.02382032]
|
||||
13 [0.02576526] [-0.02221819]
|
||||
14 [0.02403231] [-0.02072382]
|
||||
15 [0.02241593] [-0.01932995]
|
||||
16 [0.02090825] [-0.01802984]
|
||||
17 [0.01950199] [-0.01681717]
|
||||
18 [0.0181903] [-0.01568607]
|
||||
19 [0.01696684] [-0.01463104]
|
||||
20 [0.01582567] [-0.01364697]
|
||||
21 [0.01476125] [-0.01272909]
|
||||
22 [0.01376843] [-0.01187295]
|
||||
23 [0.01284238] [-0.01107438]
|
||||
24 [0.01197861] [-0.01032953]
|
||||
25 [0.01117294] [-0.00963478]
|
||||
26 [0.01042146] [-0.00898675]
|
||||
27 [0.00972053] [-0.00838232]
|
||||
28 [0.00906674] [-0.00781853]
|
||||
29 [0.00845692] [-0.00729266]
|
||||
theta from own gd
|
||||
[[3.88006918]
|
||||
[3.10131081]]
|
||||
0 [-0.03403584] [0.02875156]
|
||||
1 [-0.03184307] [0.02689923]
|
||||
2 [-0.02913373] [0.02461054]
|
||||
3 [-0.02644397] [0.02233838]
|
||||
4 [-0.02393338] [0.02021757]
|
||||
5 [-0.02163828] [0.01827881]
|
||||
6 [-0.0195557] [0.01651955]
|
||||
7 [-0.01767104] [0.0149275]
|
||||
8 [-0.01596717] [0.01348817]
|
||||
9 [-0.01442732] [0.01218739]
|
||||
10 [-0.01303588] [0.01101198]
|
||||
11 [-0.0117786] [0.0099499]
|
||||
12 [-0.01064258] [0.00899025]
|
||||
13 [-0.00961612] [0.00812316]
|
||||
14 [-0.00868866] [0.00733969]
|
||||
15 [-0.00785065] [0.00663179]
|
||||
16 [-0.00709346] [0.00599216]
|
||||
17 [-0.00640931] [0.00541422]
|
||||
18 [-0.00579114] [0.00489203]
|
||||
19 [-0.00523259] [0.0044202]
|
||||
20 [-0.00472792] [0.00399388]
|
||||
21 [-0.00427191] [0.00360867]
|
||||
22 [-0.00385989] [0.00326062]
|
||||
23 [-0.00348761] [0.00294614]
|
||||
24 [-0.00315124] [0.00266199]
|
||||
25 [-0.0028473] [0.00240524]
|
||||
26 [-0.00257269] [0.00217326]
|
||||
27 [-0.00232455] [0.00196365]
|
||||
28 [-0.00210035] [0.00177426]
|
||||
29 [-0.00189778] [0.00160314]
|
||||
[[4.02727068]
|
||||
[2.97648364]]
|
||||
0 [0.00788811] [-0.00680217]
|
||||
1 [0.00735757] [-0.00634466]
|
||||
2 [0.00670354] [-0.00578067]
|
||||
3 [0.00605646] [-0.00522268]
|
||||
4 [0.00545499] [-0.004704]
|
||||
5 [0.00490765] [-0.00423202]
|
||||
6 [0.00441336] [-0.00380578]
|
||||
7 [0.00396824] [-0.00342194]
|
||||
8 [0.0035678] [-0.00307663]
|
||||
9 [0.0032077] [-0.0027661]
|
||||
10 [0.00288393] [-0.0024869]
|
||||
11 [0.00259283]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.00223587]
|
||||
12 [0.0023311] [-0.00201018]
|
||||
13 [0.0020958] [-0.00180727]
|
||||
14 [0.00188425] [-0.00162485]
|
||||
15 [0.00169405] [-0.00146083]
|
||||
16 [0.00152305] [-0.00131337]
|
||||
17 [0.00136931] [-0.0011808]
|
||||
18 [0.00123109] [-0.00106161]
|
||||
19 [0.00110682] [-0.00095445]
|
||||
20 [0.0009951] [-0.00085811]
|
||||
21 [0.00089465] [-0.00077149]
|
||||
22 [0.00080435] [-0.00069361]
|
||||
23 [0.00072315] [-0.0006236]
|
||||
24 [0.00065016] [-0.00056065]
|
||||
25 [0.00058453] [-0.00050406]
|
||||
26 [0.00052553] [-0.00045318]
|
||||
27 [0.00047248] [-0.00040743]
|
||||
28 [0.00042479] [-0.00036631]
|
||||
29 [0.00038191] [-0.00032933]
|
||||
theta from own gd wth momentum
|
||||
[[3.99395784]
|
||||
[3.00510408]]
|
||||
[[4.00118705]
|
||||
[2.99897637]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2690,18 +2698,20 @@ theta from own gd wth momentum
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[3.97904015]
|
||||
[3.11938084]]
|
||||
Eigenvalues of Hessian Matrix:[0.29437712 4.50172351]
|
||||
[[4.0673337 ]
|
||||
[3.09000242]]
|
||||
Eigenvalues of Hessian Matrix:[0.26130347 4.78927162]
|
||||
theta from own gd
|
||||
[[3.97904015]
|
||||
[3.11938084]]
|
||||
[[4.0673337 ]
|
||||
[3.09000242]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_104_1.png" src="_images/week40_104_1.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
|
||||
[[3.97069113]
|
||||
[3.13904707]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[4.05489878]
|
||||
[3.10152451]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2783,17 +2793,15 @@ theta from own gd
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.20902858]
|
||||
[2.82421714]]
|
||||
Eigenvalues of Hessian Matrix:[0.29463222 4.67204559]
|
||||
[[4.03339089]
|
||||
[2.92919287]]
|
||||
Eigenvalues of Hessian Matrix:[0.26140984 4.96218268]
|
||||
theta from own gd
|
||||
[[4.20862308]
|
||||
[2.82454109]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg with momentum
|
||||
[[4.13343872]
|
||||
[2.81165023]]
|
||||
[[4.02898102]
|
||||
[2.93257133]]
|
||||
theta from own sdg with momentum
|
||||
[[3.97015949]
|
||||
[2.98377605]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2862,9 +2870,9 @@ theta from own gd
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own AdaGrad
|
||||
[[1.90103664]
|
||||
[3.54492296]
|
||||
[3.47989639]]
|
||||
[[2.00049449]
|
||||
[2.99756956]
|
||||
[4.00250108]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2940,9 +2948,9 @@ theta from own gd
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own RMSprop
|
||||
[[1.99858474]
|
||||
[3.00521037]
|
||||
[3.99718155]]
|
||||
[[1.99984033]
|
||||
[3.00099032]
|
||||
[3.99898545]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3022,9 +3030,9 @@ theta from own gd
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own ADAM
|
||||
[[2.00002505]
|
||||
[2.99981314]
|
||||
[4.00017937]]
|
||||
[[1.99995089]
|
||||
[3.0002889 ]
|
||||
[3.99971485]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3145,7 +3153,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
|
||||
return asarray(x, dtype=self.dtype)
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x117269df0>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x1181696a0>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_120_2.png" src="_images/week40_120_2.png" />
|
||||
@@ -3180,7 +3188,7 @@ It provides composable transformations of Python+NumPy programs: differentiate,
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x117195940>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x1180defa0>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_122_1.png" src="_images/week40_122_1.png" />
|
||||
|
||||
@@ -348,6 +348,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Exercises week 43
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week44.html">
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||