update jupyter-book
@@ -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="radius error <= 0.643\ngini = 0.008\nsamples = 242\nvalue = [[241, 1]\n[1, 241]]", fillcolor="#e5833c"] ;
|
||||
3 [label="area error <= 48.975\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="perimeter error <= 4.249\ngini = 0.444\nsamples = 3\nvalue = [[2, 1]\n[1, 2]]", fillcolor="#fdf6f0"] ;
|
||||
5 [label="radius error <= 0.688\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 ;
|
||||
@@ -22,7 +22,7 @@ edge [fontname="helvetica"] ;
|
||||
8 -> 9 ;
|
||||
10 [label="gini = 0.0\nsamples = 3\nvalue = [[0, 3]\n[3, 0]]", fillcolor="#e58139"] ;
|
||||
8 -> 10 ;
|
||||
11 [label="mean texture <= 16.22\ngini = 0.278\nsamples = 6\nvalue = [[1, 5]\n[5, 1]]", fillcolor="#f4caac"] ;
|
||||
11 [label="worst texture <= 24.785\ngini = 0.278\nsamples = 6\nvalue = [[1, 5]\n[5, 1]]", fillcolor="#f4caac"] ;
|
||||
1 -> 11 ;
|
||||
12 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139"] ;
|
||||
11 -> 12 ;
|
||||
@@ -30,11 +30,11 @@ edge [fontname="helvetica"] ;
|
||||
11 -> 13 ;
|
||||
14 [label="worst texture <= 20.645\ngini = 0.202\nsamples = 167\nvalue = [[19, 148]\n[148, 19]]", fillcolor="#f0b68c"] ;
|
||||
0 -> 14 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
|
||||
15 [label="worst concavity <= 0.318\ngini = 0.375\nsamples = 16\nvalue = [[12, 4]\n[4, 12]]", fillcolor="#f9e3d4"] ;
|
||||
15 [label="worst radius <= 17.74\ngini = 0.375\nsamples = 16\nvalue = [[12, 4]\n[4, 12]]", fillcolor="#f9e3d4"] ;
|
||||
14 -> 15 ;
|
||||
16 [label="gini = 0.0\nsamples = 11\nvalue = [[11, 0]\n[0, 11]]", fillcolor="#e58139"] ;
|
||||
15 -> 16 ;
|
||||
17 [label="mean perimeter <= 98.115\ngini = 0.32\nsamples = 5\nvalue = [[1, 4]\n[4, 1]]", fillcolor="#f6d5bd"] ;
|
||||
17 [label="worst compactness <= 0.126\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 ;
|
||||
@@ -42,13 +42,13 @@ edge [fontname="helvetica"] ;
|
||||
17 -> 19 ;
|
||||
20 [label="mean concave points <= 0.049\ngini = 0.088\nsamples = 151\nvalue = [[7, 144]\n[144, 7]]", fillcolor="#ea985d"] ;
|
||||
14 -> 20 ;
|
||||
21 [label="concave points error <= 0.01\ngini = 0.48\nsamples = 15\nvalue = [[6, 9]\n[9, 6]]", fillcolor="#ffffff"] ;
|
||||
21 [label="compactness error <= 0.016\ngini = 0.48\nsamples = 15\nvalue = [[6, 9]\n[9, 6]]", fillcolor="#ffffff"] ;
|
||||
20 -> 21 ;
|
||||
22 [label="gini = 0.0\nsamples = 9\nvalue = [[0, 9]\n[9, 0]]", fillcolor="#e58139"] ;
|
||||
21 -> 22 ;
|
||||
23 [label="gini = 0.0\nsamples = 6\nvalue = [[6, 0]\n[0, 6]]", fillcolor="#e58139"] ;
|
||||
21 -> 23 ;
|
||||
24 [label="mean smoothness <= 0.079\ngini = 0.015\nsamples = 136\nvalue = [[1, 135]\n[135, 1]]", fillcolor="#e6853f"] ;
|
||||
24 [label="worst smoothness <= 0.096\ngini = 0.015\nsamples = 136\nvalue = [[1, 135]\n[135, 1]]", fillcolor="#e6853f"] ;
|
||||
20 -> 24 ;
|
||||
25 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139"] ;
|
||||
24 -> 25 ;
|
||||
|
||||
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 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: 9.9 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 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: 22 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1086,11 +1091,11 @@ 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.97977855]
|
||||
[2.07927777]
|
||||
Coefficient beta :
|
||||
[[5.06813806]]
|
||||
Mean squared error: 0.20
|
||||
Variance score: 0.90
|
||||
[[4.95907063]]
|
||||
Mean squared error: 0.22
|
||||
Variance score: 0.91
|
||||
Mean squared log error: 0.01
|
||||
Mean absolute error: 0.37
|
||||
</pre></div>
|
||||
@@ -1192,7 +1197,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.004999999999999996
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.005000000000000004
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1403,7 +1408,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_20753/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_76811/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -1702,45 +1707,6 @@ Lambda = 10.0
|
||||
Accuracy score on test set: 0.925
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 1e-05
|
||||
Accuracy score on test set: 0.9472222222222222
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 0.0001
|
||||
Accuracy score on test set: 0.9277777777777778
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 0.001
|
||||
Accuracy score on test set: 0.9472222222222222
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 0.01
|
||||
Accuracy score on test set: 0.9305555555555556
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 0.1
|
||||
Accuracy score on test set: 0.9555555555555556
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
Lambda = 1.0
|
||||
Accuracy score on test set: 0.7694444444444445
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Learning rate = 0.01
|
||||
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_20753/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</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>
|
||||
@@ -1751,17 +1717,18 @@ Accuracy score on test set: 0.19166666666666668
|
||||
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">DNN_numpy</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">dnn</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">test_predict</span> <span class="o">=</span> <span class="n">dnn</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X_test</span><span class="p">)</span>
|
||||
|
||||
<span class="nn">Cell In[6], line 99,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="nn">Cell In[6], line 98,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">95</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">96</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="ne">---> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
<span class="ne">---> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
|
||||
<span class="nn">Cell In[6], line 64,</span> in <span class="ni">NeuralNetwork.backpropagation</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">61</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_weights_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">a_h</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">error_output</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">62</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_bias_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">error_output</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="ne">---> </span><span class="mi">64</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_weights_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">X_data</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">error_hidden</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">65</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_bias_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">error_hidden</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">67</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">lmbd</span> <span class="o">></span> <span class="mf">0.0</span><span class="p">:</span>
|
||||
<span class="nn">Cell In[6], line 38,</span> in <span class="ni">NeuralNetwork.feed_forward</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">36</span> <span class="k">def</span> <span class="nf">feed_forward</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">37</span> <span class="c1"># feed-forward for training</span>
|
||||
<span class="ne">---> </span><span class="mi">38</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_h</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">X_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_bias</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">39</span> <span class="bp">self</span><span class="o">.</span><span class="n">a_h</span> <span class="o">=</span> <span class="n">sigmoid</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_h</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">41</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_o</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">a_h</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_bias</span>
|
||||
|
||||
<span class="ne">KeyboardInterrupt</span>:
|
||||
</pre></div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1335,10 +1340,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.03726977611299938
|
||||
4.262466605211622
|
||||
[[0.83354173 2.32104741]
|
||||
[2.32104741 7.32657772]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.07753675114613659
|
||||
3.7056640671387777
|
||||
[[ 1.04061312 3.10280114]
|
||||
[ 3.10280114 10.15295172]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1375,10 +1380,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.07860645184491624
|
||||
1.2936571226638978
|
||||
[[1. 0.66747609]
|
||||
[0.66747609 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.08394467351014487
|
||||
1.6207140122788155
|
||||
[[1. 0.62913273]
|
||||
[0.62913273 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1408,30 +1413,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>[[-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]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-1.51530018 -5.52405562]
|
||||
[-0.12754161 -0.1185269 ]
|
||||
[ 1.52226126 3.76791825]
|
||||
[ 0.53838544 1.31599532]
|
||||
[ 0.62034064 2.82815583]
|
||||
[-0.57902694 -2.39362955]
|
||||
[-0.9992839 -3.26786103]
|
||||
[-1.07415889 -3.24735297]
|
||||
[ 0.61880799 2.07584629]
|
||||
[ 0.99551619 4.56351038]]
|
||||
0 1
|
||||
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.515300 -5.524056
|
||||
1 -0.127542 -0.118527
|
||||
2 1.522261 3.767918
|
||||
3 0.538385 1.315995
|
||||
4 0.620341 2.828156
|
||||
5 -0.579027 -2.393630
|
||||
6 -0.999284 -3.267861
|
||||
7 -1.074159 -3.247353
|
||||
8 0.618808 2.075846
|
||||
9 0.995516 4.563510
|
||||
0 1
|
||||
0 1.000000 0.978369
|
||||
1 0.978369 1.000000
|
||||
0 1.000000 0.977638
|
||||
1 0.977638 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1488,37 +1493,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.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
|
||||
1 0.0 0.064918 0.066625 0.070709 0.066738 0.062466 0.066234 0.061496
|
||||
2 0.0 0.066625 0.069854 0.074673 0.071414 0.067564 0.071285 0.066813
|
||||
3 0.0 0.070709 0.074673 0.081315 0.078121 0.074215 0.079025 0.074295
|
||||
4 0.0 0.066738 0.071414 0.078121 0.075719 0.072469 0.076899 0.072783
|
||||
5 0.0 0.062466 0.067564 0.074215 0.072469 0.069799 0.073864 0.070314
|
||||
6 0.0 0.066234 0.071285 0.079025 0.076899 0.073864 0.078892 0.074884
|
||||
7 0.0 0.061496 0.066813 0.074295 0.072783 0.070314 0.074884 0.071456
|
||||
8 0.0 0.057063 0.062501 0.069694 0.068679 0.066688 0.070846 0.067922
|
||||
9 0.0 0.052982 0.058442 0.065333 0.064718 0.063128 0.066918 0.064427
|
||||
10 0.0 0.060254 0.065730 0.073835 0.072549 0.070283 0.075233 0.071953
|
||||
11 0.0 0.055830 0.061349 0.069058 0.068223 0.066402 0.070895 0.068100
|
||||
12 0.0 0.051815 0.057304 0.064628 0.064155 0.062706 0.066794 0.064414
|
||||
13 0.0 0.048182 0.053593 0.060546 0.060365 0.059226 0.062955 0.060930
|
||||
14 0.0 0.044899 0.050198 0.056798 0.056851 0.055971 0.059383 0.057659
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
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
|
||||
1 0.057063 0.052982 0.060254 0.055830 0.051815 0.048182 0.044899
|
||||
2 0.062501 0.058442 0.065730 0.061349 0.057304 0.053593 0.050198
|
||||
3 0.069694 0.065333 0.073835 0.069058 0.064628 0.060546 0.056798
|
||||
4 0.068679 0.064718 0.072549 0.068223 0.064155 0.060365 0.056851
|
||||
5 0.066688 0.063128 0.070283 0.066402 0.062706 0.059226 0.055971
|
||||
6 0.070846 0.066918 0.075233 0.070895 0.066794 0.062955 0.059383
|
||||
7 0.067922 0.064427 0.071953 0.068100 0.064414 0.060930 0.057659
|
||||
8 0.064834 0.061731 0.068536 0.065121 0.061814 0.058658 0.055672
|
||||
9 0.061731 0.058976 0.065134 0.062107 0.059142 0.056285 0.053560
|
||||
10 0.068536 0.065134 0.072904 0.069119 0.065481 0.062027 0.058774
|
||||
11 0.065121 0.062107 0.069119 0.065772 0.062517 0.059399 0.056439
|
||||
12 0.061814 0.059142 0.065481 0.062517 0.059603 0.056786 0.054091
|
||||
13 0.058658 0.056285 0.062027 0.059399 0.056786 0.054238 0.051782
|
||||
14 0.055672 0.053560 0.058774 0.056439 0.054091 0.051782 0.049540
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -889,10 +894,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.156654 sec
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Runtime: 0.159617 sec
|
||||
Jackknife Statistics :
|
||||
original bias std. error
|
||||
100.193 100.183 0.150667
|
||||
99.9045 99.8945 0.150698
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1111,7 +1116,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.159 15.0085 100.157 0.150625
|
||||
99.9457 15.0851 99.9458 0.149903
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1318,7 +1323,9 @@ Error: 0.08426840630693411
|
||||
Bias^2: 0.0796891867672603
|
||||
Var: 0.004579219539673834
|
||||
0.08426840630693411 >= 0.0796891867672603 + 0.004579219539673834 = 0.08426840630693413
|
||||
Polynomial degree: 2
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 2
|
||||
Error: 0.10398646080125035
|
||||
Bias^2: 0.1007711427354898
|
||||
Var: 0.0032153180657605116
|
||||
@@ -1340,7 +1347,10 @@ 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
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree:
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 6
|
||||
Error: 0.037813671417389005
|
||||
Bias^2: 0.033657685071527665
|
||||
Var: 0.00415598634586135
|
||||
@@ -1360,14 +1370,14 @@ Error: 0.02660572763718093
|
||||
Bias^2: 0.010018312644137363
|
||||
Var: 0.016587414993043573
|
||||
0.02660572763718093 >= 0.010018312644137363 + 0.016587414993043573 = 0.026605727637180936
|
||||
Polynomial degree: 10
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 10
|
||||
Error: 0.021592704588025025
|
||||
Bias^2: 0.010516485576645508
|
||||
Var: 0.011076219011379514
|
||||
0.021592704588025025 >= 0.010516485576645508 + 0.011076219011379514 = 0.021592704588025022
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 11
|
||||
Polynomial degree: 11
|
||||
Error: 0.07160048164233104
|
||||
Bias^2: 0.014436800088904942
|
||||
Var: 0.05716368155342608
|
||||
@@ -1386,7 +1396,7 @@ Var: 0.20867052175034223
|
||||
0.22842468702219465 >= 0.01975416527185249 + 0.20867052175034223 = 0.2284246870221947
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter3_66_4.png" src="_images/chapter3_66_4.png" />
|
||||
<img alt="_images/chapter3_66_6.png" src="_images/chapter3_66_6.png" />
|
||||
</div>
|
||||
</div>
|
||||
<p>The bias-variance tradeoff summarizes the fundamental tension in
|
||||
@@ -1607,62 +1617,64 @@ Mean squared error on test data: 123711.53703498
|
||||
Degree of polynomial: 3
|
||||
Mean squared error on training data: 9011.85263220
|
||||
Mean squared error on test data: 10913.84780262
|
||||
Degree of polynomial: 4
|
||||
Mean squared error on training data: 303.47610036
|
||||
Mean squared error on test data: 426.30787294
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 5
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 4
|
||||
Mean squared error on training data: 303.47610036
|
||||
Mean squared error on test data: 426.30787294
|
||||
Degree of polynomial: 5
|
||||
Mean squared error on training data: 3.80354994
|
||||
Mean squared error on test data: 5.98822371
|
||||
Degree of polynomial: 6
|
||||
Mean squared error on training data: 3.66204648
|
||||
Mean squared error on test data: 8.14812206
|
||||
Degree of polynomial: 7
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 7
|
||||
Mean squared error on training data: 0.47075725
|
||||
Mean squared error on test data: 2.00607783
|
||||
Degree of polynomial: 8
|
||||
Mean squared error on training data: 0.04912436
|
||||
Mean squared error on test data: 0.21596432
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 9
|
||||
Degree of polynomial: 9
|
||||
Mean squared error on training data: 0.02522069
|
||||
Mean squared error on test data: 0.08576932
|
||||
Degree of polynomial: 10
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 10
|
||||
Mean squared error on training data: 0.02511518
|
||||
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
|
||||
</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.00813803
|
||||
Mean squared error on test data: 0.17446471
|
||||
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.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
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 15
|
||||
Degree of polynomial: 15
|
||||
Mean squared error on training data: 0.00410478
|
||||
Mean squared error on test data: 92.09163947
|
||||
Degree of polynomial: 16
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 16
|
||||
Mean squared error on training data: 0.00315593
|
||||
Mean squared error on test data: 234.38827994
|
||||
Degree of polynomial: 17
|
||||
Mean squared error on training data: 0.00242999
|
||||
Mean squared error on test data: 1271.34367970
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 18
|
||||
Degree of polynomial: 18
|
||||
Mean squared error on training data: 0.00228740
|
||||
Mean squared error on test data: 108.21093775
|
||||
Degree of polynomial: 19
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 19
|
||||
Mean squared error on training data: 0.00156374
|
||||
Mean squared error on test data: 1385.79778008
|
||||
Degree of polynomial: 20
|
||||
@@ -1682,18 +1694,20 @@ 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
|
||||
Degree of polynomial: 25
|
||||
Mean squared error on training data: 0.00079125
|
||||
Mean squared error on test data: 129012.83870189
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 26
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 25
|
||||
Mean squared error on training data: 0.00079125
|
||||
Mean squared error on test data: 129012.83870189
|
||||
Degree of polynomial: 26
|
||||
Mean squared error on training data: 0.00076908
|
||||
Mean squared error on test data: 18388.59354079
|
||||
Degree of polynomial: 27
|
||||
Mean squared error on training data: 0.00069123
|
||||
Mean squared error on test data: 2351.97979891
|
||||
Degree of polynomial: 28
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00062592
|
||||
Mean squared error on test data: 3983.63037846
|
||||
Degree of polynomial: 29
|
||||
@@ -1701,13 +1715,13 @@ 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_20789/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_76898/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_20789/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76898/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter3_69_9.png" src="_images/chapter3_69_9.png" />
|
||||
<img alt="_images/chapter3_69_11.png" src="_images/chapter3_69_11.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1937,7 +1951,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_20789/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_76898/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2826,7 +2840,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_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.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76898/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>
|
||||
@@ -2970,7 +2984,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_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.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76898/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>
|
||||
@@ -3010,7 +3024,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_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.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76898/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>
|
||||
@@ -3045,7 +3059,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_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.
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76898/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>
|
||||
@@ -3098,43 +3112,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:06, 1.30it/s]
|
||||
10%|█████████████▍ | 1/10 [00:01<00:10, 1.18s/it]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 20%|████████████████████ | 2/10 [00:01<00:06, 1.25it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 20%|██████████████████████████▊ | 2/10 [00:02<00:09, 1.13s/it]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 30%|██████████████████████████████ | 3/10 [00:02<00:04, 1.44it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 30%|████████████████████████████████████████▏ | 3/10 [00:03<00:07, 1.00s/it]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 40%|████████████████████████████████████████ | 4/10 [00:02<00:03, 1.52it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 40%|█████████████████████████████████████████████████████▌ | 4/10 [00:03<00:05, 1.07it/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.53it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 50%|███████████████████████████████████████████████████████████████████ | 5/10 [00:04<00:04, 1.15it/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:05<00:03, 1.19it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|██████████████████████████████████████████████████████████████████████ | 7/10 [00:04<00:02, 1.46it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 70%|█████████████████████████████████████████████████████████████████████████████████████████████▊ | 7/10 [00:06<00:02, 1.25it/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.49it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 80%|███████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 8/10 [00:07<00:01, 1.24it/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.50it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> 90%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 9/10 [00:07<00:00, 1.18it/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.55it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:08<00:00, 1.19it/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.49it/s]
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:08<00:00, 1.14it/s]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -817,9 +822,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: -0.7397605907501061
|
||||
first power: 0.007373805280423706
|
||||
second power: 0.00026005429911763394
|
||||
zero power: -4.655365720948307
|
||||
first power: 0.09332315952999948
|
||||
second power: -0.0004298347114567659
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter6_1_1.png" src="_images/chapter6_1_1.png" />
|
||||
@@ -1682,12 +1687,8 @@ attributes at each step while growing the tree.</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
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Test set accuracy with SVM: 0.63
|
||||
Test set accuracy with Logistic Regression: 0.94
|
||||
Test set accuracy with SVM: 0.63
|
||||
Test set accuracy with Decision Trees: 0.90
|
||||
Test set accuracy Logistic Regression with scaled data: 0.96
|
||||
Test set accuracy SVM with scaled data: 0.96
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -771,10 +776,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.0610096522011426
|
||||
3.8847504075456363
|
||||
[[ 1.07280604 3.11827698]
|
||||
[ 3.11827698 10.20730033]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.07475005787902417
|
||||
4.35510226157812
|
||||
[[ 1.02595928 3.2527634 ]
|
||||
[ 3.2527634 11.12684733]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -814,10 +819,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.08699604706693358
|
||||
1.8785678201327416
|
||||
[[1. 0.67701729]
|
||||
[0.67701729 1. ]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.0746776881193676
|
||||
1.7289381470678358
|
||||
[[1. 0.74948572]
|
||||
[0.74948572 1. ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -846,32 +851,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>[[-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
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[-0.16405003 0.54955605]
|
||||
[-0.11637304 -0.7621305 ]
|
||||
[ 0.01996582 1.48906628]
|
||||
[-0.79270207 -3.3173567 ]
|
||||
[ 0.52745417 2.2316734 ]
|
||||
[ 1.34172766 4.48299299]
|
||||
[-0.60711982 -1.1103761 ]
|
||||
[-1.56812901 -5.66825374]
|
||||
[ 0.74859587 2.31737432]
|
||||
[ 0.61063045 -0.212546 ]]
|
||||
0 1
|
||||
0 1.000000 0.932605
|
||||
1 0.932605 1.000000
|
||||
0 -0.164050 0.549556
|
||||
1 -0.116373 -0.762131
|
||||
2 0.019966 1.489066
|
||||
3 -0.792702 -3.317357
|
||||
4 0.527454 2.231673
|
||||
5 1.341728 4.482993
|
||||
6 -0.607120 -1.110376
|
||||
7 -1.568129 -5.668254
|
||||
8 0.748596 2.317374
|
||||
9 0.610630 -0.212546
|
||||
0 1
|
||||
0 1.000000 0.933053
|
||||
1 0.933053 1.000000
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -928,37 +931,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.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
|
||||
1 0.0 0.091870 0.082074 0.092077 0.086967 0.081650 0.082936 0.079181
|
||||
2 0.0 0.082074 0.074742 0.080377 0.076475 0.072462 0.071634 0.068667
|
||||
3 0.0 0.092077 0.080377 0.097651 0.091384 0.084848 0.091276 0.086696
|
||||
4 0.0 0.086967 0.076475 0.091384 0.085807 0.079987 0.084996 0.080907
|
||||
5 0.0 0.081650 0.072462 0.084848 0.079987 0.074920 0.078475 0.074883
|
||||
6 0.0 0.082936 0.071634 0.091276 0.084996 0.078475 0.087603 0.082951
|
||||
7 0.0 0.079181 0.068667 0.086696 0.080907 0.074883 0.082951 0.078670
|
||||
8 0.0 0.075515 0.065793 0.082200 0.076895 0.071365 0.078384 0.074464
|
||||
9 0.0 0.071891 0.062978 0.077729 0.072907 0.067875 0.073847 0.070281
|
||||
10 0.0 0.073837 0.063468 0.083409 0.077459 0.071310 0.081647 0.077164
|
||||
11 0.0 0.070649 0.060893 0.079551 0.073998 0.068246 0.077709 0.073536
|
||||
12 0.0 0.067610 0.058445 0.075858 0.070684 0.065314 0.073933 0.070055
|
||||
13 0.0 0.064698 0.056110 0.072302 0.067495 0.062496 0.070295 0.066700
|
||||
14 0.0 0.061891 0.053872 0.068856 0.064406 0.059771 0.066768 0.063444
|
||||
|
||||
8 9 10 11 12 13 14
|
||||
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
|
||||
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
|
||||
1 0.075515 0.071891 0.073837 0.070649 0.067610 0.064698 0.061891
|
||||
2 0.065793 0.062978 0.063468 0.060893 0.058445 0.056110 0.053872
|
||||
3 0.082200 0.077729 0.083409 0.079551 0.075858 0.072302 0.068856
|
||||
4 0.076895 0.072907 0.077459 0.073998 0.070684 0.067495 0.064406
|
||||
5 0.071365 0.067875 0.071310 0.068246 0.065314 0.062496 0.059771
|
||||
6 0.078384 0.073847 0.081647 0.077709 0.073933 0.070295 0.066768
|
||||
7 0.074464 0.070281 0.077164 0.073536 0.070055 0.066700 0.063444
|
||||
8 0.070610 0.066774 0.072769 0.069439 0.066244 0.063164 0.060174
|
||||
9 0.066774 0.063285 0.068412 0.065374 0.062458 0.059646 0.056918
|
||||
10 0.072769 0.068412 0.077270 0.073441 0.069770 0.066233 0.062805
|
||||
11 0.069439 0.065374 0.073441 0.069876 0.066455 0.063158 0.059960
|
||||
12 0.066244 0.062458 0.069770 0.066455 0.063273 0.060204 0.057225
|
||||
13 0.063164 0.059646 0.066233 0.063158 0.060204 0.057353 0.054585
|
||||
14 0.060174 0.056918 0.062805 0.059960 0.057225 0.054585 0.052021
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1147,10 +1150,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 4.021032 1.990843
|
||||
1 1.990843 1.969959
|
||||
[[4.02103235 1.99084335]
|
||||
[1.99084335 1.9699594 ]]
|
||||
0 4.070272 2.059136
|
||||
1 2.059136 2.054311
|
||||
[[4.07027208 2.05913631]
|
||||
[2.05913631 2.05431096]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1177,8 +1180,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
|
||||
[[4.02103235 1.99084335]
|
||||
[1.99084335 1.9699594 ]]
|
||||
[[4.07027208 2.05913631]
|
||||
[2.05913631 2.05431096]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/chapter8_65_1.png" src="_images/chapter8_65_1.png" />
|
||||
@@ -1238,16 +1241,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.234956145890017
|
||||
0.7560356057040467
|
||||
5.3549029458698545
|
||||
0.7696800897647572
|
||||
First eigenvector
|
||||
[0.85379714 0.52060584]
|
||||
[0.84842937 0.5293086 ]
|
||||
Second eigenvector
|
||||
[-0.52060584 0.85379714]
|
||||
[-0.5293086 0.84842937]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvector of largest eigenvalue
|
||||
[-0.85379714 -0.52060584]
|
||||
[-0.84842937 -0.5293086 ]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -351,6 +351,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -824,15 +829,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
|
||||
[[3.72796854]
|
||||
[3.26269704]]
|
||||
Eigenvalues of Hessian Matrix:[0.26876494 4.16606994]
|
||||
[[3.7056279 ]
|
||||
[3.11632514]]
|
||||
Eigenvalues of Hessian Matrix:[0.27378241 4.9133261 ]
|
||||
theta from own gd
|
||||
[[3.72796854]
|
||||
[3.26269704]]
|
||||
[[3.7056279 ]
|
||||
[3.11632514]]
|
||||
theta from own sdg
|
||||
[[3.70521262]
|
||||
[3.29966563]]
|
||||
[[3.62227539]
|
||||
[3.09214577]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_5_1.png" src="_images/exercisesweek41_5_1.png" />
|
||||
@@ -954,15 +959,17 @@ 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.89549614]
|
||||
[2.9788957 ]]
|
||||
Eigenvalues of Hessian Matrix:[0.34210288 4.43495138]
|
||||
theta from own gd
|
||||
[[3.89549614]
|
||||
[2.9788957 ]]
|
||||
[[4.39586211]
|
||||
[2.54142449]]
|
||||
Eigenvalues of Hessian Matrix:[0.29253829 4.61759155]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_16_1.png" src="_images/exercisesweek41_16_1.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
[[4.39586211]
|
||||
[2.54142449]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_16_2.png" src="_images/exercisesweek41_16_2.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1030,73 +1037,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.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]
|
||||
Eigenvalues of Hessian Matrix:[0.28360073 4.6466172 ]
|
||||
0 [-12.76941488] [-15.71728253]
|
||||
1 [-0.06385864] [0.05142606]
|
||||
2 [-0.0599611] [0.04828733]
|
||||
3 [-0.05630145] [0.04534017]
|
||||
4 [-0.05286516] [0.04257289]
|
||||
5 [-0.0496386] [0.0399745]
|
||||
6 [-0.04660896] [0.03753471]
|
||||
7 [-0.04376424] [0.03524382]
|
||||
8 [-0.04109314] [0.03309276]
|
||||
9 [-0.03858507] [0.03107298]
|
||||
10 [-0.03623008] [0.02917648]
|
||||
11 [-0.03401882] [0.02739573]
|
||||
12 [-0.03194252] [0.02572366]
|
||||
13 [-0.02999295] [0.02415365]
|
||||
14 [-0.02816236] [0.02267946]
|
||||
15 [-0.02644351] [0.02129525]
|
||||
16 [-0.02482956] [0.01999552]
|
||||
17 [-0.02331412] [0.01877511]
|
||||
18 [-0.02189117] [0.0176292]
|
||||
19 [-0.02055507] [0.01655322]
|
||||
20 [-0.01930051] [0.01554291]
|
||||
21 [-0.01812253] [0.01459427]
|
||||
22 [-0.01701644] [0.01370353]
|
||||
23 [-0.01597786] [0.01286715]
|
||||
24 [-0.01500267] [0.01208182]
|
||||
25 [-0.014087] [0.01134442]
|
||||
26 [-0.01322722] [0.01065202]
|
||||
27 [-0.01241991] [0.01000189]
|
||||
28 [-0.01166188] [0.00939144]
|
||||
29 [-0.01095011] [0.00881824]
|
||||
theta from own gd
|
||||
[[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]
|
||||
[[3.96374557]
|
||||
[3.02919609]]
|
||||
0 [-0.01028178] [0.00828003]
|
||||
1 [-0.00965425] [0.00777467]
|
||||
2 [-0.00887675] [0.00714854]
|
||||
3 [-0.00810172] [0.0065244]
|
||||
4 [-0.00737473] [0.00593895]
|
||||
5 [-0.00670653] [0.00540084]
|
||||
6 [-0.00609674] [0.00490977]
|
||||
7 [-0.0055417] [0.00446279]
|
||||
8 [-0.00503695] [0.00405631]
|
||||
9 [-0.00457811] [0.0036868]
|
||||
10 [-0.00416103] [0.00335092]
|
||||
11 [-0.00378195] [0.00304564]
|
||||
12 [-0.00343739] [0.00276817]
|
||||
13 [-0.00312423] [0.00251598]
|
||||
14 [-0.0028396] [0.00228676]
|
||||
15 [-0.0025809] [0.00207843]
|
||||
16 [-0.00234577] [0.00188907]
|
||||
17 [-0.00213205] [0.00171697]
|
||||
18 [-0.00193781] [0.00156054]
|
||||
19 [-0.00176127] [0.00141837]
|
||||
20 [-0.00160081] [0.00128915]
|
||||
21 [-0.00145497] [0.0011717]
|
||||
22 [-0.00132241] [0.00106495]
|
||||
23 [-0.00120193] [0.00096793]
|
||||
24 [-0.00109243] [0.00087975]
|
||||
25 [-0.00099291] [0.0007996]
|
||||
26 [-0.00090245] [0.00072675]
|
||||
27 [-0.00082023] [0.00066054]
|
||||
28 [-0.0007455] [0.00060036]
|
||||
29 [-0.00067758] [0.00054567]
|
||||
theta from own gd wth momentum
|
||||
[[3.99925917]
|
||||
[3.00070146]]
|
||||
[[3.99782845]
|
||||
[3.00174877]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1149,17 +1156,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
|
||||
[[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]
|
||||
[[3.60911869]
|
||||
[3.33987045]]
|
||||
Eigenvalues of Hessian Matrix:[0.31385073 4.08833652]
|
||||
0 [-17.89749468] [-19.42504764]
|
||||
1 [-6.56419363e-15] [-6.5758826e-15]
|
||||
2 [-4.99600361e-16] [-5.64393388e-16]
|
||||
3 [-4.99600361e-16] [-5.64393388e-16]
|
||||
4 [-4.99600361e-16] [-5.64393388e-16]
|
||||
beta from own Newton code
|
||||
[[3.86751196]
|
||||
[3.13877544]]
|
||||
[[3.60911869]
|
||||
[3.33987045]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1248,22 +1255,20 @@ 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
|
||||
[[3.90340018]
|
||||
[3.20732292]]
|
||||
Eigenvalues of Hessian Matrix:[0.30252911 4.09446058]
|
||||
[[4.41451936]
|
||||
[2.55289042]]
|
||||
Eigenvalues of Hessian Matrix:[0.33812981 4.19713213]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
[[3.90340018]
|
||||
[3.20732292]]
|
||||
[[4.41451936]
|
||||
[2.55289042]]
|
||||
</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
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[3.86364839]
|
||||
[3.23799188]]
|
||||
[[4.38642255]
|
||||
[2.56985133]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1345,15 +1350,17 @@ Eigenvalues of Hessian Matrix:[0.30252911 4.09446058]
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Own inversion
|
||||
[[4.38463079]
|
||||
[2.57169626]]
|
||||
Eigenvalues of Hessian Matrix:[0.27355018 4.06502525]
|
||||
[[3.89425071]
|
||||
[3.03737777]]
|
||||
Eigenvalues of Hessian Matrix:[0.32691458 3.94394646]
|
||||
theta from own gd
|
||||
[[4.38343773]
|
||||
[2.57278714]]
|
||||
theta from own sdg with momentum
|
||||
[[4.35254442]
|
||||
[2.58244397]]
|
||||
[[3.89408559]
|
||||
[3.03753095]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg with momentum
|
||||
[[3.92801972]
|
||||
[3.02259232]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1428,9 +1435,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.0000375 ]
|
||||
[2.99981967]
|
||||
[4.00017395]]
|
||||
[[1.99987339]
|
||||
[3.00070766]
|
||||
[3.99931264]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1512,9 +1519,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.99998686]
|
||||
[2.9995237 ]
|
||||
[4.00046845]]
|
||||
[[1.99430797]
|
||||
[3.0204309 ]
|
||||
[3.97790579]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1600,9 +1607,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
|
||||
[[1.99990776]
|
||||
[3.0005044 ]
|
||||
[3.99956442]]
|
||||
[[1.99988575]
|
||||
[3.00066222]
|
||||
[3.99946201]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1675,7 +1682,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 0x11edfa8b0>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x12288f460>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_39_2.png" src="_images/exercisesweek41_39_2.png" />
|
||||
@@ -1710,7 +1717,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 0x11ef1aac0>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x110657310>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/exercisesweek41_41_1.png" src="_images/exercisesweek41_41_1.png" />
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -349,6 +349,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</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"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -673,8 +678,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.32001824 -0.74192227 0.29589074 0.79474214 0.93002171 -0.3039884
|
||||
-0.23453753 0.42163714 0.38469469 -0.16425426]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[-0.16520328 1.62291487 -1.6087843 0.42672668 -0.54245399 -0.47389944
|
||||
1.54395649 0.30474374 0.88958816 1.67644921]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -895,26 +900,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.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]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.28784593 0.96321926 0.20866637 0.95849867 0.92941344 0.1506968
|
||||
0.22840543 0.0920889 0.80793317 0.50389563]
|
||||
[0.17183189 0.20143625 0.45450913 0.00646788 0.86626878 0.08925572
|
||||
0.52334702 0.03991659 0.35369204 0.78536632]
|
||||
[0.16039093 0.84796642 0.82292496 0.94439363 0.30258327 0.61219766
|
||||
0.73629812 0.16934353 0.17379702 0.04679308]
|
||||
[0.63996185 0.11274165 0.25945116 0.89423541 0.22346992 0.21007634
|
||||
0.36949491 0.48033198 0.62082039 0.32646485]
|
||||
[0.74365467 0.7733283 0.7928694 0.77278596 0.58641617 0.32914379
|
||||
0.84818156 0.91522307 0.69515573 0.58154488]
|
||||
[0.31956141 0.10975592 0.3919079 0.90613668 0.5978168 0.96954883
|
||||
0.92380565 0.41038312 0.32288529 0.55800813]
|
||||
[0.81494889 0.50633361 0.99792993 0.31899022 0.78486135 0.8728734
|
||||
0.01932215 0.67005078 0.19206115 0.83068485]
|
||||
[0.83903596 0.48440335 0.66923495 0.46990302 0.80674666 0.96465867
|
||||
0.23114262 0.71841354 0.23608218 0.10929587]
|
||||
[0.94970686 0.08965584 0.07768608 0.19814125 0.38472539 0.36807444
|
||||
0.29740527 0.95391872 0.21994185 0.13166051]
|
||||
[0.88743493 0.10721234 0.91281804 0.15125714 0.58166986 0.37588174
|
||||
0.12925014 0.00524148 0.93747994 0.33514166]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -974,13 +979,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.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]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.08051403053372341
|
||||
3.7140333805249566
|
||||
-0.380671880038213
|
||||
[[ 0.92926923 2.65811424 2.52618757]
|
||||
[ 2.65811424 8.74246828 7.24691709]
|
||||
[ 2.52618757 7.24691709 11.65085456]]
|
||||
[18.34869216 0.09587752 2.87802239]
|
||||
</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="Week 44, Convolutional Neural Networks (CNN)" href="week44.html" />
|
||||
<link rel="prev" title="Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)" href="week45.html" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="docsearch:language" content="None">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1099,11 +1104,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="week44.html" title="previous page">
|
||||
<a class='left-prev' id="prev-link" href="week45.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">Week 44, Convolutional Neural Networks (CNN)</p>
|
||||
<p class="prev-next-title">Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)</p>
|
||||
</div>
|
||||
</a>
|
||||
<a class='right-next' id="next-link" href="project2.html" title="next page">
|
||||
|
||||
@@ -352,6 +352,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -28,7 +28,7 @@ display(data_pandas)
|
||||
|
||||
[0;31m---------------------------------------------------------------------------[0m
|
||||
[0;31mAttributeError[0m Traceback (most recent call last)
|
||||
[0;32m/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20912/1326197715.py[0m in [0;36m?[0;34m()[0m
|
||||
[0;32m/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_77069/1326197715.py[0m in [0;36m?[0;34m()[0m
|
||||
[0;32m----> 6[0;31m new_hobbit = {'First Name': ["Peregrin"],
|
||||
[0m[1;32m 7[0m [0;34m'Last Name'[0m[0;34m:[0m [0;34m[[0m[0;34m"Took"[0m[0;34m][0m[0;34m,[0m[0;34m[0m[0;34m[0m[0m
|
||||
[1;32m 8[0m [0;34m'Place of birth'[0m[0;34m:[0m [0;34m[[0m[0;34m"Shire"[0m[0;34m][0m[0;34m,[0m[0;34m[0m[0;34m[0m[0m
|
||||
|
||||
@@ -351,6 +351,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -355,6 +355,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1045,27 +1050,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>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]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>3.56625717949593
|
||||
[[ 1.06428266 0.38523213 1.79328214 2.08565179 2.50663068 6.8647244
|
||||
3.38978208 3.14317326 1.71034931 3.18370342]
|
||||
[ 0.38523213 0.13944021 0.64910378 0.7549311 0.90731036 2.48478389
|
||||
1.22697947 1.13771593 0.61908508 1.15238639]
|
||||
[ 1.79328214 0.64910378 3.02162289 3.51425636 4.22359229 11.56684041
|
||||
5.71167406 5.29614612 2.88188373 5.36443813]
|
||||
[ 2.08565179 0.7549311 3.51425636 4.08720685 4.91219011 13.45265242
|
||||
6.64288286 6.15960888 3.35173468 6.23903496]
|
||||
[ 2.50663068 0.90731036 4.22359229 4.91219011 5.90369232 16.16800633
|
||||
7.98371718 7.40289664 4.02826638 7.49835449]
|
||||
[ 6.8647244 2.48478389 11.56684041 13.45265242 16.16800633 44.27812536
|
||||
21.86441684 20.27376652 11.03191576 20.53518988]
|
||||
[ 3.38978208 1.22697947 5.71167406 6.64288286 7.98371718 21.86441684
|
||||
10.79658906 10.01113029 5.44752974 10.14022043]
|
||||
[ 3.14317326 1.13771593 5.29614612 6.15960888 7.40289664 20.27376652
|
||||
10.01113029 9.28281416 5.05121846 9.4025129 ]
|
||||
[ 1.71034931 0.61908508 2.88188373 3.35173468 4.02826638 11.03191576
|
||||
5.44752974 5.05121846 2.748607 5.11635222]
|
||||
[ 3.18370342 1.15238639 5.36443813 6.23903496 7.49835449 20.53518988
|
||||
10.14022043 9.4025129 5.11635222 9.52375513]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1333,15 +1338,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.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]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.15035891139512705
|
||||
4.404353162658163
|
||||
0.26135632456837465
|
||||
0.8498535115108263 9.637848274275777 7.478236340866993
|
||||
2.683498103515284 1.8820155508745924 5.929759221040619
|
||||
[[0.84985351 2.6834981 1.88201555]
|
||||
[2.6834981 9.63784827 5.92975922]
|
||||
[1.88201555 5.92975922 7.47823634]]
|
||||
[15.32272016 0.08352309 2.55969487]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1671,7 +1676,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.007840665517467031 0.9968742237157096
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.030334875296061884 0.9620141923630161
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/statistics_188_1.png" src="_images/statistics_188_1.png" />
|
||||
|
||||
@@ -351,6 +351,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -351,6 +351,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1733,8 +1738,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.23735423 -0.34348527 -0.45751302 -0.40762065 0.81063784 -1.91668429
|
||||
0.84661055 0.10685672 -0.72237094 0.95928891]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 0.85931214 0.24652971 -0.37701519 -0.89783832 -0.42039617 -0.67620794
|
||||
-0.44628307 -1.04740468 -0.04108062 -0.29079591]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1959,26 +1964,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.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]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[0.95931945 0.57024095 0.91760903 0.39906075 0.08876834 0.0124713
|
||||
0.07144982 0.90842396 0.31617139 0.63909748]
|
||||
[0.52227438 0.89628285 0.96204868 0.34041977 0.11488067 0.27531797
|
||||
0.84740026 0.96646907 0.01508687 0.91848382]
|
||||
[0.17567367 0.55226232 0.73928393 0.68427669 0.13209303 0.91110232
|
||||
0.66357762 0.95798449 0.23780732 0.57013694]
|
||||
[0.39601249 0.53330587 0.06724937 0.34147319 0.64000462 0.24442775
|
||||
0.08281003 0.21557021 0.74700686 0.85155422]
|
||||
[0.61622002 0.92426453 0.66272682 0.30987607 0.01246098 0.31590735
|
||||
0.90414289 0.30579641 0.57699385 0.70800322]
|
||||
[0.39877985 0.76367045 0.85955305 0.74839066 0.92476147 0.77428214
|
||||
0.03819297 0.23549133 0.69784571 0.32911747]
|
||||
[0.87296643 0.7830823 0.17061798 0.7985321 0.73566263 0.0340743
|
||||
0.25628535 0.04001968 0.22513383 0.66806437]
|
||||
[0.14969552 0.72009597 0.07446067 0.06999566 0.91352474 0.87201153
|
||||
0.46028772 0.47205747 0.59014356 0.82634908]
|
||||
[0.29641931 0.78136042 0.27682145 0.1368858 0.42647707 0.952696
|
||||
0.28275928 0.03545828 0.89830971 0.7410929 ]
|
||||
[0.62359412 0.48568753 0.67008686 0.16348056 0.67873521 0.24664656
|
||||
0.32919746 0.43159669 0.25110398 0.02351604]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2033,13 +2038,15 @@ 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.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]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-0.22756606771104732
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>3.350239046451652
|
||||
-0.6358520333139864
|
||||
[[ 0.90960239 2.70429053 2.46370204]
|
||||
[ 2.70429053 9.06600773 7.55327382]
|
||||
[ 2.46370204 7.55327382 10.78633152]]
|
||||
[18.29046498 0.08692737 2.38454929]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2264,7 +2271,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_20912/1326197715.py</span> in <span class="ni">?</span><span class="nt">()</span>
|
||||
<span class="nn">/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_77069/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>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1701,7 +1706,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.9960309859796598
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9947527587517572
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1718,7 +1723,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.009724998242604404
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.010439235860004352
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1733,23 +1738,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.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]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.0048774 0.03000546 0.01406224 0.05284539 0.04788783 0.02130229
|
||||
0.02623134 0.0312189 0.00828271 0.0333264 0.01039127 0.04606288
|
||||
0.00142296 0.06417796 0.02234126 0.04466842 0.00261107 0.03529826
|
||||
0.03378921 0.0156846 0.02446687 0.00786113 0.06293914 0.01926522
|
||||
0.07425157 0.00050463 0.0262532 0.02488913 0.01273055 0.01047937
|
||||
0.00315702 0.01270269 0.01876257 0.01064438 0.00386265 0.04092917
|
||||
0.00922185 0.09242706 0.0525407 0.00986929 0.02216059 0.01901332
|
||||
0.00896715 0.00402758 0.00442984 0.04099237 0.0017715 0.04160022
|
||||
0.00999576 0.00218856 0.14483777 0.12286595 0.0149996 0.00194921
|
||||
0.00548026 0.01104374 0.00535653 0.05810465 0.0309014 0.00765756
|
||||
0.02954296 0.03077893 0.00995375 0.00133161 0.03530044 0.02867709
|
||||
0.00081442 0.00844629 0.03069367 0.01296443 0.03185121 0.02650658
|
||||
0.02861286 0.00404165 0.11084763 0.01832954 0.00300884 0.01447841
|
||||
0.00247535 0.03531926 0.07316645 0.00458923 0.05633629 0.02054047
|
||||
0.05805861 0.0313967 0.02247131 0.03145864 0.01764364 0.01408861
|
||||
0.035408 0.01927749 0.01439591 0.04600803 0.06175351 0.04317055
|
||||
0.00567929 0.00594615 0.03811479 0.00122361]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1818,15 +1823,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>[ 2.014896 -0.32009434 6.3804687 -1.81093622 0.74663164]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 1.91347831 1.11445241 1.9118945 2.92213071 -0.82152512]
|
||||
Training R2
|
||||
0.9955259363342327
|
||||
0.9955496867333266
|
||||
Training MSE
|
||||
0.00915723745398148
|
||||
0.009741790670425911
|
||||
Test R2
|
||||
0.9941130198635889
|
||||
0.9962595442701554
|
||||
Test MSE
|
||||
0.009410131112671444
|
||||
0.007025375342852509
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2489,7 +2494,9 @@ the aims is to reproduce Figure 2.11 of <a class="reference external" href="http
|
||||
</div>
|
||||
<div class="cell_output docutils container">
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>MSE before scaling: 0.00
|
||||
R2 score before scaling 1.00
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>R2 score before scaling 1.00
|
||||
Feature min values before scaling:
|
||||
[1.00000000e+00 6.97906022e-03 2.43639284e-03 4.87072815e-05
|
||||
1.70037324e-05 5.93601008e-06 3.39931051e-07 1.18670072e-07
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1689,7 +1694,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.9722 14.9105 99.9697 0.149904
|
||||
99.7516 14.8757 99.7508 0.147628
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1936,14 +1941,14 @@ Error: 0.037813671417389005
|
||||
Bias^2: 0.033657685071527665
|
||||
Var: 0.00415598634586135
|
||||
0.037813671417389005 >= 0.033657685071527665 + 0.00415598634586135 = 0.03781367141738902
|
||||
Polynomial degree: 7
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 7
|
||||
Error: 0.02760977349102253
|
||||
Bias^2: 0.022999498260366312
|
||||
Var: 0.004610275230656212
|
||||
0.02760977349102253 >= 0.022999498260366312 + 0.004610275230656212 = 0.027609773491022525
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 8
|
||||
Polynomial degree: 8
|
||||
Error: 0.017355848195593347
|
||||
Bias^2: 0.010331721306655127
|
||||
Var: 0.007024126888938232
|
||||
@@ -1958,14 +1963,14 @@ Error: 0.021592704588025025
|
||||
Bias^2: 0.010516485576645508
|
||||
Var: 0.011076219011379514
|
||||
0.021592704588025025 >= 0.010516485576645508 + 0.011076219011379514 = 0.021592704588025022
|
||||
Polynomial degree: 11
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 11
|
||||
Error: 0.07160048164233104
|
||||
Bias^2: 0.014436800088904942
|
||||
Var: 0.05716368155342608
|
||||
0.07160048164233104 >= 0.014436800088904942 + 0.05716368155342608 = 0.07160048164233102
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 12
|
||||
Polynomial degree: 12
|
||||
Error: 0.11547777218872497
|
||||
Bias^2: 0.01628578269596628
|
||||
Var: 0.09919198949275869
|
||||
@@ -2314,29 +2319,31 @@ 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
|
||||
Degree of polynomial: 4
|
||||
Mean squared error on training data: 302.15313054
|
||||
Mean squared error on test data: 433.26292364
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 5
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 4
|
||||
Mean squared error on training data: 302.15313054
|
||||
Mean squared error on test data: 433.26292364
|
||||
Degree of polynomial: 5
|
||||
Mean squared error on training data: 3.64316192
|
||||
Mean squared error on test data: 7.23528337
|
||||
Degree of polynomial: 6
|
||||
Mean squared error on training data: 3.56589683
|
||||
Mean squared error on test data: 10.50427787
|
||||
Degree of polynomial: 7
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 7
|
||||
Mean squared error on training data: 0.47313680
|
||||
Mean squared error on test data: 1.53738247
|
||||
Degree of polynomial: 8
|
||||
Mean squared error on training data: 0.04926746
|
||||
Mean squared error on test data: 0.14629156
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 9
|
||||
Degree of polynomial: 9
|
||||
Mean squared error on training data: 0.02546675
|
||||
Mean squared error on test data: 0.11202337
|
||||
Degree of polynomial: 10
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 10
|
||||
Mean squared error on training data: 0.02424794
|
||||
Mean squared error on test data: 0.22467274
|
||||
Degree of polynomial: 11
|
||||
@@ -2356,29 +2363,31 @@ 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
|
||||
Degree of polynomial: 16
|
||||
Mean squared error on training data: 0.00325450
|
||||
Mean squared error on test data: 48.97630233
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 17
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 16
|
||||
Mean squared error on training data: 0.00325450
|
||||
Mean squared error on test data: 48.97630233
|
||||
Degree of polynomial: 17
|
||||
Mean squared error on training data: 0.00242954
|
||||
Mean squared error on test data: 2.52780600
|
||||
Degree of polynomial: 18
|
||||
Mean squared error on training data: 0.00219195
|
||||
Mean squared error on test data: 429.25695398
|
||||
Degree of polynomial: 19
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 19
|
||||
Mean squared error on training data: 0.00154853
|
||||
Mean squared error on test data: 239.97065359
|
||||
Degree of polynomial: 20
|
||||
Mean squared error on training data: 0.00140846
|
||||
Mean squared error on test data: 1350.24493666
|
||||
</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.00119688
|
||||
Mean squared error on test data: 1840.50530832
|
||||
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.00092898
|
||||
Mean squared error on test data: 1184.60929685
|
||||
Degree of polynomial: 23
|
||||
@@ -2398,23 +2407,23 @@ 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
|
||||
Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00063362
|
||||
Mean squared error on test data: 674.79633065
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 29
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 28
|
||||
Mean squared error on training data: 0.00063362
|
||||
Mean squared error on test data: 674.79633065
|
||||
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_20933/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_77095/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_20933/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_77095/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(testerror), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week37_148_9.png" src="_images/week37_148_9.png" />
|
||||
<img alt="_images/week37_148_11.png" src="_images/week37_148_11.png" />
|
||||
</div>
|
||||
</div>
|
||||
<p>Note that we kept the intercept column in the fitting here. This means that we need to set the <strong>intercept</strong> in the call to the <strong>Scikit-Learn</strong> function as <strong>False</strong>. Alternatively, we could have set up the design matrix <span class="math notranslate nohighlight">\(X\)</span> without the first column of ones.</p>
|
||||
@@ -2495,7 +2504,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_20933/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_77095/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
|
||||
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
|
||||
</pre></div>
|
||||
</div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1832,7 +1837,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 0x120b67a60>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><mpl_toolkits.mplot3d.art3d.Poly3DCollection at 0x122f46a60>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_82_1.png" src="_images/week39_82_1.png" />
|
||||
@@ -1890,7 +1895,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 0x1213d5ee0>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x123702f40>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_90_1.png" src="_images/week39_90_1.png" />
|
||||
@@ -2184,11 +2189,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.31492096 4.28033995]
|
||||
[[3.6006178 ]
|
||||
[3.29753883]]
|
||||
[[3.6006178 ]
|
||||
[3.29753883]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.33763884 4.08158332]
|
||||
[[3.77424745]
|
||||
[3.10328867]]
|
||||
[[3.77424745]
|
||||
[3.10328867]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_153_1.png" src="_images/week39_153_1.png" />
|
||||
@@ -2219,9 +2224,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.87513212]
|
||||
[3.12510307]]
|
||||
[3.90280702] [3.15433894]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[4.08279986]
|
||||
[2.951111 ]]
|
||||
[4.11089309] [2.99612864]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2321,11 +2326,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.28372329 4.0956114 ]
|
||||
[[3.8980893 ]
|
||||
[3.08479726]]
|
||||
[[3.89868561]
|
||||
[3.08425705]]
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Eigenvalues of Hessian Matrix:[0.33983515 4.43295134]
|
||||
[[3.51397199]
|
||||
[3.23805301]]
|
||||
[[3.51348514]
|
||||
[3.23845558]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_166_1.png" src="_images/week39_166_1.png" />
|
||||
@@ -2439,7 +2444,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_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.)
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_77123/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>
|
||||
@@ -2550,7 +2555,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_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.)
|
||||
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_77123/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>
|
||||
@@ -3906,16 +3911,16 @@ beta from own Newton code
|
||||
[[4.0586484]
|
||||
[3.0718316]]
|
||||
Eigenvalues of Hessian Matrix:[0.29860173 3.8931686 ]
|
||||
theta from own gd
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own gd
|
||||
[[4.0586484]
|
||||
[3.0718316]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week39_269_1.png" src="_images/week39_269_1.png" />
|
||||
<img alt="_images/week39_269_2.png" src="_images/week39_269_2.png" />
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[4.02496085]
|
||||
[[4.02496085]
|
||||
[3.12081773]]
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -4004,7 +4009,9 @@ Eigenvalues of Hessian Matrix:[0.27470622 4.24106503]
|
||||
theta from own gd
|
||||
[[3.95906059]
|
||||
[3.02296298]]
|
||||
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 sdg with momentum
|
||||
[[3.95611042]
|
||||
[2.99475306]]
|
||||
</pre></div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -1334,17 +1339,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.52649344]
|
||||
[4.28384131]
|
||||
[4.39301381]]
|
||||
[[3.76032301]
|
||||
[3.57617159]
|
||||
[4.73446638]]
|
||||
Parameters for Ridge using gradient descent
|
||||
[[3.85580661]
|
||||
[3.22264403]
|
||||
[4.90636879]]
|
||||
[[3.76932996]
|
||||
[3.5039644 ]
|
||||
[4.75712924]]
|
||||
Parameters for Lasso using gradient descent
|
||||
[[3.48209228]
|
||||
[4.41003194]
|
||||
[4.32994479]]
|
||||
[[3.74798782]
|
||||
[3.67690253]
|
||||
[4.66901006]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1396,11 +1401,11 @@ Parameters for Lasso using gradient descent
|
||||
[[4.]
|
||||
[3.]
|
||||
[5.]]
|
||||
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]
|
||||
0 [-20.64198317] [-25.87140002]
|
||||
1 [6.95621338e-14] [5.25198941e-14]
|
||||
2 [-3.73034936e-16] [-1.60665948e-16]
|
||||
3 [-1.0658141e-15] [-1.43711157e-15]
|
||||
4 [1.77635684e-17] [-6.65473135e-17]
|
||||
beta from own Newton code
|
||||
[[4.]
|
||||
[3.]
|
||||
@@ -1742,15 +1747,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.97648396]
|
||||
[3.02497282]]
|
||||
Eigenvalues of Hessian Matrix:[0.33604933 4.1740886 ]
|
||||
[[4.13728033]
|
||||
[3.07121643]]
|
||||
Eigenvalues of Hessian Matrix:[0.28247102 4.2443802 ]
|
||||
theta from own gd
|
||||
[[3.97648396]
|
||||
[3.02497282]]
|
||||
[[4.13728033]
|
||||
[3.07121643]]
|
||||
theta from own sdg
|
||||
[[3.93398716]
|
||||
[3.06433206]]
|
||||
[[4.17261945]
|
||||
[3.03589192]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_34_1.png" src="_images/week40_34_1.png" />
|
||||
@@ -2464,12 +2469,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.12726334]
|
||||
[2.9658822 ]]
|
||||
Eigenvalues of Hessian Matrix:[0.31252573 4.38126738]
|
||||
[[3.80299938]
|
||||
[3.15999738]]
|
||||
Eigenvalues of Hessian Matrix:[0.30207164 4.19150648]
|
||||
theta from own gd
|
||||
[[4.12726334]
|
||||
[2.9658822 ]]
|
||||
[[3.80299938]
|
||||
[3.15999738]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_100_1.png" src="_images/week40_100_1.png" />
|
||||
@@ -2540,76 +2545,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.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]
|
||||
Eigenvalues of Hessian Matrix:[0.30537749 4.93567389]
|
||||
0 [-12.05438211] [-15.75248147]
|
||||
1 [-0.05121539] [0.03891196]
|
||||
2 [-0.04804662] [0.03650442]
|
||||
3 [-0.0450739] [0.03424583]
|
||||
4 [-0.04228511] [0.03212699]
|
||||
5 [-0.03966887] [0.03013925]
|
||||
6 [-0.0372145] [0.02827449]
|
||||
7 [-0.03491198] [0.0265251]
|
||||
8 [-0.03275192] [0.02488396]
|
||||
9 [-0.03072551] [0.02334435]
|
||||
10 [-0.02882448] [0.0219]
|
||||
11 [-0.02704107] [0.02054501]
|
||||
12 [-0.025368] [0.01927386]
|
||||
13 [-0.02379844] [0.01808136]
|
||||
14 [-0.022326] [0.01696264]
|
||||
15 [-0.02094465] [0.01591314]
|
||||
16 [-0.01964878] [0.01492857]
|
||||
17 [-0.01843308] [0.01400491]
|
||||
18 [-0.0172926] [0.01313841]
|
||||
19 [-0.01622268] [0.01232552]
|
||||
20 [-0.01521896] [0.01156292]
|
||||
21 [-0.01427734] [0.0108475]
|
||||
22 [-0.01339398] [0.01017635]
|
||||
23 [-0.01256527] [0.00954673]
|
||||
24 [-0.01178784] [0.00895606]
|
||||
25 [-0.01105851] [0.00840193]
|
||||
26 [-0.0103743] [0.00788209]
|
||||
27 [-0.00973243] [0.00739441]
|
||||
28 [-0.00913027] [0.00693691]
|
||||
29 [-0.00856537] [0.00650771]
|
||||
theta from own gd
|
||||
[[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]
|
||||
[[3.97368695]
|
||||
[3.01999189]]
|
||||
0 [-0.00803541] [0.00610507]
|
||||
1 [-0.00753825] [0.00572734]
|
||||
2 [-0.0069227] [0.00525966]
|
||||
3 [-0.00630972] [0.00479394]
|
||||
4 [-0.00573543] [0.00435761]
|
||||
5 [-0.00520828] [0.0039571]
|
||||
6 [-0.0047279] [0.00359212]
|
||||
7 [-0.00429126] [0.00326037]
|
||||
8 [-0.00389476] [0.00295912]
|
||||
9 [-0.00353484] [0.00268566]
|
||||
10 [-0.00320815] [0.00243746]
|
||||
11 [-0.00291165] [0.00221219]
|
||||
12 [-0.00264256] [0.00200774]
|
||||
13 [-0.00239833] [0.00182218]
|
||||
14 [-0.00217667] [0.00165377]
|
||||
15 [-0.0019755] [0.00150093]
|
||||
16 [-0.00179292] [0.00136221]
|
||||
17 [-0.00162722] [0.00123631]
|
||||
18 [-0.00147683] [0.00112205]
|
||||
19 [-0.00134034] [0.00101835]
|
||||
20 [-0.00121646] [0.00092423]
|
||||
21 [-0.00110404] [0.00083881]
|
||||
22 [-0.001002] [0.00076129]
|
||||
23 [-0.00090939] [0.00069093]
|
||||
24 [-0.00082535] [0.00062707]
|
||||
25 [-0.00074907] [0.00056912]
|
||||
26 [-0.00067984] [0.00051652]
|
||||
27 [-0.000617] [0.00046878]
|
||||
28 [-0.00055998] [0.00042546]
|
||||
29 [-0.00050823] [0.00038614]
|
||||
theta from own gd wth momentum
|
||||
[[4.00118705]
|
||||
[2.99897637]]
|
||||
[[3.99848956]
|
||||
[3.00114759]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2698,20 +2700,18 @@ 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.0673337 ]
|
||||
[3.09000242]]
|
||||
Eigenvalues of Hessian Matrix:[0.26130347 4.78927162]
|
||||
[[3.95706219]
|
||||
[2.94033531]]
|
||||
Eigenvalues of Hessian Matrix:[0.25953954 4.69528374]
|
||||
theta from own gd
|
||||
[[4.0673337 ]
|
||||
[3.09000242]]
|
||||
[[3.95706219]
|
||||
[2.94033531]]
|
||||
</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
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[[4.05489878]
|
||||
[3.10152451]]
|
||||
[[3.96702819]
|
||||
[2.94477897]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2793,15 +2793,17 @@ 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.03339089]
|
||||
[2.92919287]]
|
||||
Eigenvalues of Hessian Matrix:[0.26140984 4.96218268]
|
||||
[[3.85971308]
|
||||
[3.13443492]]
|
||||
Eigenvalues of Hessian Matrix:[0.34481288 4.03344366]
|
||||
theta from own gd
|
||||
[[4.02898102]
|
||||
[2.93257133]]
|
||||
theta from own sdg with momentum
|
||||
[[3.97015949]
|
||||
[2.98377605]]
|
||||
[[3.85978751]
|
||||
[3.13436777]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>theta from own sdg with momentum
|
||||
[[3.86241466]
|
||||
[3.1395446 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2870,9 +2872,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.00049449]
|
||||
[2.99756956]
|
||||
[4.00250108]]
|
||||
[[2.00000814]
|
||||
[2.99996221]
|
||||
[4.00003533]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2948,9 +2950,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.99984033]
|
||||
[3.00099032]
|
||||
[3.99898545]]
|
||||
[[2.0000694 ]
|
||||
[2.99939966]
|
||||
[4.00063665]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3030,9 +3032,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
|
||||
[[1.99995089]
|
||||
[3.0002889 ]
|
||||
[3.99971485]]
|
||||
[[1.9999563 ]
|
||||
[3.00054639]
|
||||
[3.999445 ]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3153,7 +3155,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 0x1181696a0>]
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[<matplotlib.lines.Line2D at 0x11f8442e0>]
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_120_2.png" src="_images/week40_120_2.png" />
|
||||
@@ -3188,7 +3190,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 0x1180defa0>
|
||||
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span><matplotlib.collections.PathCollection at 0x11f812730>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/week40_122_1.png" src="_images/week40_122_1.png" />
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -3396,7 +3401,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_20969/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_77168/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3732,7 +3737,7 @@ 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_20969/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_77168/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3741,7 +3746,7 @@ 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_20969/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_77168/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3750,7 +3755,7 @@ 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_20969/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_77168/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3759,7 +3764,7 @@ 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_20969/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_77168/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -3768,115 +3773,10 @@ 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_20969/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_77168/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_20969/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_20969/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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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.001
|
||||
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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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.01
|
||||
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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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.1
|
||||
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_20969/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 = 1.0
|
||||
Lambda = 1.0
|
||||
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_20969/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20969/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">10</span><span class="p">],</span> <span class="n">line</span> <span class="mi">11</span>
|
||||
@@ -3887,18 +3787,10 @@ Accuracy score on test set: 0.10555555555555556
|
||||
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">DNN_numpy</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">dnn</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">test_predict</span> <span class="o">=</span> <span class="n">dnn</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X_test</span><span class="p">)</span>
|
||||
|
||||
<span class="nn">Cell In[8], line 98,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">95</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="nn">Cell In[8], line 99,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">96</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="ne">---> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
|
||||
<span class="nn">Cell In[8], line 38,</span> in <span class="ni">NeuralNetwork.feed_forward</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">36</span> <span class="k">def</span> <span class="nf">feed_forward</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">37</span> <span class="c1"># feed-forward for training</span>
|
||||
<span class="ne">---> </span><span class="mi">38</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_h</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">X_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_bias</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">39</span> <span class="bp">self</span><span class="o">.</span><span class="n">a_h</span> <span class="o">=</span> <span class="n">sigmoid</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_h</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">41</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_o</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">a_h</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_bias</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="ne">---> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
|
||||
<span class="ne">KeyboardInterrupt</span>:
|
||||
</pre></div>
|
||||
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -2358,7 +2363,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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2694,7 +2699,7 @@ 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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2703,7 +2708,7 @@ 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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2712,7 +2717,7 @@ 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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2721,7 +2726,7 @@ 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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2730,7 +2735,7 @@ 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_20981/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_77180/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
</pre></div>
|
||||
</div>
|
||||
@@ -2739,106 +2744,10 @@ 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_20981/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_77180/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_20981/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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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.001
|
||||
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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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.01
|
||||
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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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.1
|
||||
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_20981/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 = 1.0
|
||||
Lambda = 1.0
|
||||
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_20981/953065564.py:4: RuntimeWarning: overflow encountered in exp
|
||||
return 1/(1 + np.exp(-x))
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/1630775253.py:43: RuntimeWarning: overflow encountered in exp
|
||||
exp_term = np.exp(self.z_o)
|
||||
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20981/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>
|
||||
@@ -2849,18 +2758,17 @@ Accuracy score on test set: 0.10555555555555556
|
||||
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">DNN_numpy</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">dnn</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">test_predict</span> <span class="o">=</span> <span class="n">dnn</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X_test</span><span class="p">)</span>
|
||||
|
||||
<span class="nn">Cell In[6], line 98,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">95</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">X_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="nn">Cell In[6], line 99,</span> in <span class="ni">NeuralNetwork.train</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">96</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Y_data_full</span><span class="p">[</span><span class="n">chosen_datapoints</span><span class="p">]</span>
|
||||
<span class="ne">---> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">98</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_forward</span><span class="p">()</span>
|
||||
<span class="ne">---> </span><span class="mi">99</span> <span class="bp">self</span><span class="o">.</span><span class="n">backpropagation</span><span class="p">()</span>
|
||||
|
||||
<span class="nn">Cell In[6], line 38,</span> in <span class="ni">NeuralNetwork.feed_forward</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">36</span> <span class="k">def</span> <span class="nf">feed_forward</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">37</span> <span class="c1"># feed-forward for training</span>
|
||||
<span class="ne">---> </span><span class="mi">38</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_h</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">X_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_bias</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">39</span> <span class="bp">self</span><span class="o">.</span><span class="n">a_h</span> <span class="o">=</span> <span class="n">sigmoid</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_h</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">41</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_o</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">a_h</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_weights</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_bias</span>
|
||||
<span class="nn">Cell In[6], line 64,</span> in <span class="ni">NeuralNetwork.backpropagation</span><span class="nt">(self)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">61</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_weights_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">a_h</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">error_output</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">62</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_bias_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">error_output</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="ne">---> </span><span class="mi">64</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_weights_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">X_data</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">error_hidden</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">65</span> <span class="bp">self</span><span class="o">.</span><span class="n">hidden_bias_gradient</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">error_hidden</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
|
||||
<span class="g g-Whitespace"> </span><span class="mi">67</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">lmbd</span> <span class="o">></span> <span class="mf">0.0</span><span class="p">:</span>
|
||||
|
||||
<span class="ne">KeyboardInterrupt</span>:
|
||||
</pre></div>
|
||||
|
||||
@@ -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 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)" href="week45.html" />
|
||||
<link rel="prev" title="Exercises week 43" href="exercisesweek43.html" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="docsearch:language" content="None">
|
||||
@@ -353,6 +353,11 @@ const thebe_selector_output = ".output, .cell_output"
|
||||
Week 44, Convolutional Neural Networks (CNN)
|
||||
</a>
|
||||
</li>
|
||||
<li class="toctree-l1">
|
||||
<a class="reference internal" href="week45.html">
|
||||
Week 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p aria-level="2" class="caption" role="heading">
|
||||
<span class="caption-text">
|
||||
@@ -5364,10 +5369,10 @@ optimization technique.</p>
|
||||
<p class="prev-next-title">Exercises week 43</p>
|
||||
</div>
|
||||
</a>
|
||||
<a class='right-next' id="next-link" href="project1.html" title="next page">
|
||||
<a class='right-next' id="next-link" href="week45.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 45, Convolutional Neural Networks (CCNs) and Recurrent Neural Networks (RNNs)</p>
|
||||
</div>
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -1077,7 +1077,7 @@
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20753/953065564.py:4: RuntimeWarning: overflow encountered in exp\n",
|
||||
"/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_76811/953065564.py:4: RuntimeWarning: overflow encountered in exp\n",
|
||||
" return 1/(1 + np.exp(-x))\n"
|
||||
]
|
||||
},
|
||||
@@ -1581,84 +1581,6 @@
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 1e-05\n",
|
||||
"Accuracy score on test set: 0.9472222222222222\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 0.0001\n",
|
||||
"Accuracy score on test set: 0.9277777777777778\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 0.001\n",
|
||||
"Accuracy score on test set: 0.9472222222222222\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 0.01\n",
|
||||
"Accuracy score on test set: 0.9305555555555556\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 0.1\n",
|
||||
"Accuracy score on test set: 0.9555555555555556\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 1.0\n",
|
||||
"Accuracy score on test set: 0.7694444444444445\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Learning rate = 0.01\n",
|
||||
"Lambda = 10.0\n",
|
||||
"Accuracy score on test set: 0.19166666666666668\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_20753/953065564.py:4: RuntimeWarning: overflow encountered in exp\n",
|
||||
" return 1/(1 + np.exp(-x))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "KeyboardInterrupt",
|
||||
"evalue": "",
|
||||
@@ -1667,8 +1589,8 @@
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[8], line 11\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m j, lmbd \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(lmbd_vals):\n\u001b[1;32m 9\u001b[0m dnn \u001b[38;5;241m=\u001b[39m NeuralNetwork(X_train, Y_train_onehot, eta\u001b[38;5;241m=\u001b[39meta, lmbd\u001b[38;5;241m=\u001b[39mlmbd, epochs\u001b[38;5;241m=\u001b[39mepochs, batch_size\u001b[38;5;241m=\u001b[39mbatch_size,\n\u001b[1;32m 10\u001b[0m n_hidden_neurons\u001b[38;5;241m=\u001b[39mn_hidden_neurons, n_categories\u001b[38;5;241m=\u001b[39mn_categories)\n\u001b[0;32m---> 11\u001b[0m \u001b[43mdnn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtrain\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 13\u001b[0m DNN_numpy[i][j] \u001b[38;5;241m=\u001b[39m dnn\n\u001b[1;32m 15\u001b[0m test_predict \u001b[38;5;241m=\u001b[39m dnn\u001b[38;5;241m.\u001b[39mpredict(X_test)\n",
|
||||
"Cell \u001b[0;32mIn[6], line 99\u001b[0m, in \u001b[0;36mNeuralNetwork.train\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mY_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mY_data_full[chosen_datapoints]\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfeed_forward()\n\u001b[0;32m---> 99\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbackpropagation\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||
"Cell \u001b[0;32mIn[6], line 64\u001b[0m, in \u001b[0;36mNeuralNetwork.backpropagation\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_weights_gradient \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mmatmul(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39ma_h\u001b[38;5;241m.\u001b[39mT, error_output)\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_bias_gradient \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39msum(error_output, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m)\n\u001b[0;32m---> 64\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhidden_weights_gradient \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmatmul\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mX_data\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mT\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror_hidden\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhidden_bias_gradient \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39msum(error_hidden, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m)\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlmbd \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0.0\u001b[39m:\n",
|
||||
"Cell \u001b[0;32mIn[6], line 98\u001b[0m, in \u001b[0;36mNeuralNetwork.train\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mX_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mX_data_full[chosen_datapoints]\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mY_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mY_data_full[chosen_datapoints]\n\u001b[0;32m---> 98\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfeed_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 99\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbackpropagation()\n",
|
||||
"Cell \u001b[0;32mIn[6], line 38\u001b[0m, in \u001b[0;36mNeuralNetwork.feed_forward\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 36\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mfeed_forward\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 37\u001b[0m \u001b[38;5;66;03m# feed-forward for training\u001b[39;00m\n\u001b[0;32m---> 38\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_h \u001b[38;5;241m=\u001b[39m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmatmul\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mX_data\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhidden_weights\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhidden_bias\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39ma_h \u001b[38;5;241m=\u001b[39m sigmoid(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_h)\n\u001b[1;32m 41\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_o \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mmatmul(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39ma_h, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_weights) \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_bias\n",
|
||||
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 25 KiB |