Skip to content

Commit 9e0ab16

Browse files
committed
update
1 parent 4b3330b commit 9e0ab16

File tree

8 files changed

+363
-212
lines changed

8 files changed

+363
-212
lines changed

doc/pub/week5/html/week5-bs.html

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
2,
104104
None,
105105
'building-code-using-pytorch'),
106+
('What is dropout?', 2, None, 'what-is-dropout'),
107+
('Key benefits of Dropout:', 3, None, 'key-benefits-of-dropout'),
106108
('Building our own CNN code',
107109
2,
108110
None,
@@ -328,6 +330,8 @@
328330
<!-- navigation toc: --> <li><a href="#final-visualization" style="font-size: 80%;"><b>Final visualization</b></a></li>
329331
<!-- navigation toc: --> <li><a href="#finally-evaluate-the-model" style="font-size: 80%;"><b>Finally, evaluate the model</b></a></li>
330332
<!-- navigation toc: --> <li><a href="#building-code-using-pytorch" style="font-size: 80%;"><b>Building code using Pytorch</b></a></li>
333+
<!-- navigation toc: --> <li><a href="#what-is-dropout" style="font-size: 80%;"><b>What is dropout?</b></a></li>
334+
<!-- navigation toc: --> <li><a href="#key-benefits-of-dropout" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Key benefits of Dropout:</a></li>
331335
<!-- navigation toc: --> <li><a href="#building-our-own-cnn-code" style="font-size: 80%;"><b>Building our own CNN code</b></a></li>
332336
<!-- navigation toc: --> <li><a href="#list-of-contents" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;List of contents:</a></li>
333337
<!-- navigation toc: --> <li><a href="#schedulers" style="font-size: 80%;">&nbsp;&nbsp;&nbsp;Schedulers</a></li>
@@ -827,9 +831,7 @@ <h2 id="example-of-how-we-can-up-a-model-without-a-specific-image" class="anchor
827831
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
828832
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
829833
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
830-
831834
<span style="color: #408080; font-style: italic"># Here we display the architecture of our model so far.</span>
832-
833835
model<span style="color: #666666">.</span>summary()
834836
</pre>
835837
</div>
@@ -870,7 +872,7 @@ <h2 id="add-dense-layers-on-top" class="anchor">Add Dense layers on top </h2>
870872
<pre style="line-height: 125%;">model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
871873
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">64</span>, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
872874
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">10</span>))
873-
Here<span style="color: #BA2121">&#39;s the complete architecture of our model.</span>
875+
<span style="color: #408080; font-style: italic"># Now we list the complete architecture of our model.</span>
874876
model<span style="color: #666666">.</span>summary()
875877
</pre>
876878
</div>
@@ -1023,7 +1025,7 @@ <h2 id="running-with-keras-and-setting-up-the-model" class="anchor">Running with
10231025
model<span style="color: #666666">.</span>compile(loss<span style="color: #666666">=</span><span style="color: #BA2121">&#39;categorical_crossentropy&#39;</span>, optimizer<span style="color: #666666">=</span>sgd, metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
10241026

10251027
<span style="color: #008000; font-weight: bold">return</span> model
1026-
1028+
<span style="color: #408080; font-style: italic">#model.summary()</span>
10271029
epochs <span style="color: #666666">=</span> <span style="color: #666666">100</span>
10281030
batch_size <span style="color: #666666">=</span> <span style="color: #666666">100</span>
10291031
input_shape <span style="color: #666666">=</span> X_train<span style="color: #666666">.</span>shape[<span style="color: #666666">1</span>:<span style="color: #666666">4</span>]
@@ -1300,6 +1302,29 @@ <h2 id="building-code-using-pytorch" class="anchor">Building code using Pytorch
13001302
</div>
13011303

13021304

1305+
<!-- !split -->
1306+
<h2 id="what-is-dropout" class="anchor">What is dropout? </h2>
1307+
1308+
<p>Dropout is a regularization technique used to prevent overfitting in
1309+
neural networks. During training, a randomly selected fraction
1310+
(typically 20-50$\%$) of neurons in each layer are temporarily
1311+
deactivated (dropped out). This compels the network to distribute
1312+
feature representation across multiple neurons instead of relying on a
1313+
small subset.
1314+
</p>
1315+
<h3 id="key-benefits-of-dropout" class="anchor">Key benefits of Dropout: </h3>
1316+
1317+
<ol>
1318+
<li> Random Neuron Deactivation: Neurons are randomly ignored during each forward pass.</li>
1319+
<li> Overfitting Reduction: Encourages the learning of more robust data representations by preventing reliance on specific neurons.</li>
1320+
<li> Improved Robustness: At test time, all neurons are active, with weights scaled down to account for the training phase dropout rate.</li>
1321+
</ol>
1322+
<p>Dropout is commonly applied after fully connected layers in CNNs, but can also be used after convolutional layers.</p>
1323+
1324+
<ol>
1325+
<li> Application after convolutional layers: While less frequent, dropout can be applied between convolutional and pooling layers. The inherent regularization provided by shared weights and pooling in convolutional layers already mitigates overfitting.</li>
1326+
<li> Application after fully connected Layers: Dropout is typically applied to fully connected layers due to the increased risk of overfitting caused by the large number of parameters.</li>
1327+
</ol>
13031328
<!-- !split -->
13041329
<h2 id="building-our-own-cnn-code" class="anchor">Building our own CNN code </h2>
13051330

doc/pub/week5/html/week5-reveal.html

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,7 @@ <h2 id="example-of-how-we-can-up-a-model-without-a-specific-image">Example of ho
613613
model.add(layers.Conv2D(<span style="color: #B452CD">64</span>, (<span style="color: #B452CD">3</span>, <span style="color: #B452CD">3</span>), activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
614614
model.add(layers.MaxPooling2D((<span style="color: #B452CD">2</span>, <span style="color: #B452CD">2</span>)))
615615
model.add(layers.Conv2D(<span style="color: #B452CD">64</span>, (<span style="color: #B452CD">3</span>, <span style="color: #B452CD">3</span>), activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
616-
617616
<span style="color: #228B22"># Here we display the architecture of our model so far.</span>
618-
619617
model.summary()
620618
</pre>
621619
</div>
@@ -657,7 +655,7 @@ <h2 id="add-dense-layers-on-top">Add Dense layers on top </h2>
657655
<pre style="font-size: 80%; line-height: 125%;">model.add(layers.Flatten())
658656
model.add(layers.Dense(<span style="color: #B452CD">64</span>, activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
659657
model.add(layers.Dense(<span style="color: #B452CD">10</span>))
660-
Here<span style="color: #CD5555">&#39;s the complete architecture of our model.</span>
658+
<span style="color: #228B22"># Now we list the complete architecture of our model.</span>
661659
model.summary()
662660
</pre>
663661
</div>
@@ -811,7 +809,7 @@ <h2 id="running-with-keras-and-setting-up-the-model">Running with Keras and sett
811809
model.compile(loss=<span style="color: #CD5555">&#39;categorical_crossentropy&#39;</span>, optimizer=sgd, metrics=[<span style="color: #CD5555">&#39;accuracy&#39;</span>])
812810

813811
<span style="color: #8B008B; font-weight: bold">return</span> model
814-
812+
<span style="color: #228B22">#model.summary()</span>
815813
epochs = <span style="color: #B452CD">100</span>
816814
batch_size = <span style="color: #B452CD">100</span>
817815
input_shape = X_train.shape[<span style="color: #B452CD">1</span>:<span style="color: #B452CD">4</span>]
@@ -1089,6 +1087,32 @@ <h2 id="building-code-using-pytorch">Building code using Pytorch </h2>
10891087
</div>
10901088
</section>
10911089

1090+
<section>
1091+
<h2 id="what-is-dropout">What is dropout? </h2>
1092+
1093+
<p>Dropout is a regularization technique used to prevent overfitting in
1094+
neural networks. During training, a randomly selected fraction
1095+
(typically 20-50$\%$) of neurons in each layer are temporarily
1096+
deactivated (dropped out). This compels the network to distribute
1097+
feature representation across multiple neurons instead of relying on a
1098+
small subset.
1099+
</p>
1100+
<h3 id="key-benefits-of-dropout">Key benefits of Dropout: </h3>
1101+
1102+
<ol>
1103+
<p><li> Random Neuron Deactivation: Neurons are randomly ignored during each forward pass.</li>
1104+
<p><li> Overfitting Reduction: Encourages the learning of more robust data representations by preventing reliance on specific neurons.</li>
1105+
<p><li> Improved Robustness: At test time, all neurons are active, with weights scaled down to account for the training phase dropout rate.</li>
1106+
</ol>
1107+
<p>
1108+
<p>Dropout is commonly applied after fully connected layers in CNNs, but can also be used after convolutional layers.</p>
1109+
1110+
<ol>
1111+
<p><li> Application after convolutional layers: While less frequent, dropout can be applied between convolutional and pooling layers. The inherent regularization provided by shared weights and pooling in convolutional layers already mitigates overfitting.</li>
1112+
<p><li> Application after fully connected Layers: Dropout is typically applied to fully connected layers due to the increased risk of overfitting caused by the large number of parameters.</li>
1113+
</ol>
1114+
</section>
1115+
10921116
<section>
10931117
<h2 id="building-our-own-cnn-code">Building our own CNN code </h2>
10941118

doc/pub/week5/html/week5-solarized.html

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
2,
131131
None,
132132
'building-code-using-pytorch'),
133+
('What is dropout?', 2, None, 'what-is-dropout'),
134+
('Key benefits of Dropout:', 3, None, 'key-benefits-of-dropout'),
133135
('Building our own CNN code',
134136
2,
135137
None,
@@ -735,9 +737,7 @@ <h2 id="example-of-how-we-can-up-a-model-without-a-specific-image">Example of ho
735737
model.add(layers.Conv2D(<span style="color: #B452CD">64</span>, (<span style="color: #B452CD">3</span>, <span style="color: #B452CD">3</span>), activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
736738
model.add(layers.MaxPooling2D((<span style="color: #B452CD">2</span>, <span style="color: #B452CD">2</span>)))
737739
model.add(layers.Conv2D(<span style="color: #B452CD">64</span>, (<span style="color: #B452CD">3</span>, <span style="color: #B452CD">3</span>), activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
738-
739740
<span style="color: #228B22"># Here we display the architecture of our model so far.</span>
740-
741741
model.summary()
742742
</pre>
743743
</div>
@@ -778,7 +778,7 @@ <h2 id="add-dense-layers-on-top">Add Dense layers on top </h2>
778778
<pre style="line-height: 125%;">model.add(layers.Flatten())
779779
model.add(layers.Dense(<span style="color: #B452CD">64</span>, activation=<span style="color: #CD5555">&#39;relu&#39;</span>))
780780
model.add(layers.Dense(<span style="color: #B452CD">10</span>))
781-
Here<span style="color: #CD5555">&#39;s the complete architecture of our model.</span>
781+
<span style="color: #228B22"># Now we list the complete architecture of our model.</span>
782782
model.summary()
783783
</pre>
784784
</div>
@@ -931,7 +931,7 @@ <h2 id="running-with-keras-and-setting-up-the-model">Running with Keras and sett
931931
model.compile(loss=<span style="color: #CD5555">&#39;categorical_crossentropy&#39;</span>, optimizer=sgd, metrics=[<span style="color: #CD5555">&#39;accuracy&#39;</span>])
932932

933933
<span style="color: #8B008B; font-weight: bold">return</span> model
934-
934+
<span style="color: #228B22">#model.summary()</span>
935935
epochs = <span style="color: #B452CD">100</span>
936936
batch_size = <span style="color: #B452CD">100</span>
937937
input_shape = X_train.shape[<span style="color: #B452CD">1</span>:<span style="color: #B452CD">4</span>]
@@ -1208,6 +1208,29 @@ <h2 id="building-code-using-pytorch">Building code using Pytorch </h2>
12081208
</div>
12091209

12101210

1211+
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
1212+
<h2 id="what-is-dropout">What is dropout? </h2>
1213+
1214+
<p>Dropout is a regularization technique used to prevent overfitting in
1215+
neural networks. During training, a randomly selected fraction
1216+
(typically 20-50$\%$) of neurons in each layer are temporarily
1217+
deactivated (dropped out). This compels the network to distribute
1218+
feature representation across multiple neurons instead of relying on a
1219+
small subset.
1220+
</p>
1221+
<h3 id="key-benefits-of-dropout">Key benefits of Dropout: </h3>
1222+
1223+
<ol>
1224+
<li> Random Neuron Deactivation: Neurons are randomly ignored during each forward pass.</li>
1225+
<li> Overfitting Reduction: Encourages the learning of more robust data representations by preventing reliance on specific neurons.</li>
1226+
<li> Improved Robustness: At test time, all neurons are active, with weights scaled down to account for the training phase dropout rate.</li>
1227+
</ol>
1228+
<p>Dropout is commonly applied after fully connected layers in CNNs, but can also be used after convolutional layers.</p>
1229+
1230+
<ol>
1231+
<li> Application after convolutional layers: While less frequent, dropout can be applied between convolutional and pooling layers. The inherent regularization provided by shared weights and pooling in convolutional layers already mitigates overfitting.</li>
1232+
<li> Application after fully connected Layers: Dropout is typically applied to fully connected layers due to the increased risk of overfitting caused by the large number of parameters.</li>
1233+
</ol>
12111234
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
12121235
<h2 id="building-our-own-cnn-code">Building our own CNN code </h2>
12131236

doc/pub/week5/html/week5.html

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@
207207
2,
208208
None,
209209
'building-code-using-pytorch'),
210+
('What is dropout?', 2, None, 'what-is-dropout'),
211+
('Key benefits of Dropout:', 3, None, 'key-benefits-of-dropout'),
210212
('Building our own CNN code',
211213
2,
212214
None,
@@ -812,9 +814,7 @@ <h2 id="example-of-how-we-can-up-a-model-without-a-specific-image">Example of ho
812814
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
813815
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>MaxPooling2D((<span style="color: #666666">2</span>, <span style="color: #666666">2</span>)))
814816
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Conv2D(<span style="color: #666666">64</span>, (<span style="color: #666666">3</span>, <span style="color: #666666">3</span>), activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
815-
816817
<span style="color: #408080; font-style: italic"># Here we display the architecture of our model so far.</span>
817-
818818
model<span style="color: #666666">.</span>summary()
819819
</pre>
820820
</div>
@@ -855,7 +855,7 @@ <h2 id="add-dense-layers-on-top">Add Dense layers on top </h2>
855855
<pre style="line-height: 125%;">model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Flatten())
856856
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">64</span>, activation<span style="color: #666666">=</span><span style="color: #BA2121">&#39;relu&#39;</span>))
857857
model<span style="color: #666666">.</span>add(layers<span style="color: #666666">.</span>Dense(<span style="color: #666666">10</span>))
858-
Here<span style="color: #BA2121">&#39;s the complete architecture of our model.</span>
858+
<span style="color: #408080; font-style: italic"># Now we list the complete architecture of our model.</span>
859859
model<span style="color: #666666">.</span>summary()
860860
</pre>
861861
</div>
@@ -1008,7 +1008,7 @@ <h2 id="running-with-keras-and-setting-up-the-model">Running with Keras and sett
10081008
model<span style="color: #666666">.</span>compile(loss<span style="color: #666666">=</span><span style="color: #BA2121">&#39;categorical_crossentropy&#39;</span>, optimizer<span style="color: #666666">=</span>sgd, metrics<span style="color: #666666">=</span>[<span style="color: #BA2121">&#39;accuracy&#39;</span>])
10091009

10101010
<span style="color: #008000; font-weight: bold">return</span> model
1011-
1011+
<span style="color: #408080; font-style: italic">#model.summary()</span>
10121012
epochs <span style="color: #666666">=</span> <span style="color: #666666">100</span>
10131013
batch_size <span style="color: #666666">=</span> <span style="color: #666666">100</span>
10141014
input_shape <span style="color: #666666">=</span> X_train<span style="color: #666666">.</span>shape[<span style="color: #666666">1</span>:<span style="color: #666666">4</span>]
@@ -1285,6 +1285,29 @@ <h2 id="building-code-using-pytorch">Building code using Pytorch </h2>
12851285
</div>
12861286

12871287

1288+
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
1289+
<h2 id="what-is-dropout">What is dropout? </h2>
1290+
1291+
<p>Dropout is a regularization technique used to prevent overfitting in
1292+
neural networks. During training, a randomly selected fraction
1293+
(typically 20-50$\%$) of neurons in each layer are temporarily
1294+
deactivated (dropped out). This compels the network to distribute
1295+
feature representation across multiple neurons instead of relying on a
1296+
small subset.
1297+
</p>
1298+
<h3 id="key-benefits-of-dropout">Key benefits of Dropout: </h3>
1299+
1300+
<ol>
1301+
<li> Random Neuron Deactivation: Neurons are randomly ignored during each forward pass.</li>
1302+
<li> Overfitting Reduction: Encourages the learning of more robust data representations by preventing reliance on specific neurons.</li>
1303+
<li> Improved Robustness: At test time, all neurons are active, with weights scaled down to account for the training phase dropout rate.</li>
1304+
</ol>
1305+
<p>Dropout is commonly applied after fully connected layers in CNNs, but can also be used after convolutional layers.</p>
1306+
1307+
<ol>
1308+
<li> Application after convolutional layers: While less frequent, dropout can be applied between convolutional and pooling layers. The inherent regularization provided by shared weights and pooling in convolutional layers already mitigates overfitting.</li>
1309+
<li> Application after fully connected Layers: Dropout is typically applied to fully connected layers due to the increased risk of overfitting caused by the large number of parameters.</li>
1310+
</ol>
12881311
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
12891312
<h2 id="building-our-own-cnn-code">Building our own CNN code </h2>
12901313

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)