Skip to content

Commit

Permalink
deploy: ec94fe2
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanTodoran committed Nov 25, 2024
1 parent de57935 commit 4294dd6
Show file tree
Hide file tree
Showing 21 changed files with 765 additions and 375 deletions.
242 changes: 194 additions & 48 deletions Chapter4-DeepLearning/mlgeo_4.4_RNN.html

Large diffs are not rendered by default.

132 changes: 63 additions & 69 deletions Chapter4-DeepLearning/mlgeo_4.6_AutoEncoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,48 @@ <h1>4.6 Auto-encoders<a class="headerlink" href="#auto-encoders" title="Permalin
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz
Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz to ./FashionMNIST/raw/train-images-idx3-ubyte.gz
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|██████████| 26421880/26421880 [00:02&lt;00:00, 10417165.17it/s]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Extracting ./FashionMNIST/raw/train-images-idx3-ubyte.gz to ./FashionMNIST/raw

Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz
Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz to ./FashionMNIST/raw/train-labels-idx1-ubyte.gz
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|██████████| 29515/29515 [00:00&lt;00:00, 175578.14it/s]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Extracting ./FashionMNIST/raw/train-labels-idx1-ubyte.gz to ./FashionMNIST/raw

Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz
Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz to ./FashionMNIST/raw/t10k-images-idx3-ubyte.gz
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|██████████| 4422102/4422102 [00:01&lt;00:00, 3538808.13it/s]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Extracting ./FashionMNIST/raw/t10k-images-idx3-ubyte.gz to ./FashionMNIST/raw

Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz
Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz to ./FashionMNIST/raw/t10k-labels-idx1-ubyte.gz
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>100%|██████████| 5148/5148 [00:00&lt;00:00, 8317518.10it/s]
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Extracting ./FashionMNIST/raw/t10k-labels-idx1-ubyte.gz to ./FashionMNIST/raw
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
</div>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
Expand All @@ -820,8 +862,7 @@ <h1>4.6 Auto-encoders<a class="headerlink" href="#auto-encoders" title="Permalin
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;torch.utils.data.dataset.Subset object at 0x2af90f8b0&gt;
torch.Size([50, 1, 28, 28])
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>torch.Size([50, 1, 28, 28])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1005,11 +1046,11 @@ <h1>4.6 Auto-encoders<a class="headerlink" href="#auto-encoders" title="Permalin
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Epoch 1] train loss: 0.596 - val loss: 0.594
[Epoch 2] train loss: 0.596 - val loss: 0.593
[Epoch 3] train loss: 0.595 - val loss: 0.593
[Epoch 4] train loss: 0.595 - val loss: 0.593
[Epoch 5] train loss: 0.595 - val loss: 0.593
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Epoch 1] train loss: 0.617 - val loss: 0.603
[Epoch 2] train loss: 0.599 - val loss: 0.599
[Epoch 3] train loss: 0.596 - val loss: 0.597
[Epoch 4] train loss: 0.595 - val loss: 0.597
[Epoch 5] train loss: 0.595 - val loss: 0.596
</pre></div>
</div>
</div>
Expand All @@ -1023,7 +1064,7 @@ <h1>4.6 Auto-encoders<a class="headerlink" href="#auto-encoders" title="Permalin
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x2d0523130&gt;]
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&lt;matplotlib.lines.Line2D at 0x3154edbb0&gt;]
</pre></div>
</div>
<img alt="../_images/mlgeo_4.6_AutoEncoder_11_1.png" src="../_images/mlgeo_4.6_AutoEncoder_11_1.png" />
Expand Down Expand Up @@ -1141,11 +1182,11 @@ <h1>Convolutional autoencoder<a class="headerlink" href="#convolutional-autoenco
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Epoch 1] train loss: 0.609 - val loss: 0.574
[Epoch 2] train loss: 0.574 - val loss: 0.571
[Epoch 3] train loss: 0.572 - val loss: 0.570
[Epoch 4] train loss: 0.571 - val loss: 0.569
[Epoch 5] train loss: 0.571 - val loss: 0.569
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Epoch 1] train loss: 0.611 - val loss: 0.578
[Epoch 2] train loss: 0.574 - val loss: 0.574
[Epoch 3] train loss: 0.572 - val loss: 0.573
[Epoch 4] train loss: 0.571 - val loss: 0.573
[Epoch 5] train loss: 0.571 - val loss: 0.572
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -1176,7 +1217,7 @@ <h1>Denoising auto-encoder<a class="headerlink" href="#denoising-auto-encoder" t

<span class="c1"># Encoder</span>
<span class="bp">self</span><span class="o">.</span><span class="n">encoder</span> <span class="o">=</span> <span class="n">nn</span><span class="o">.</span><span class="n">Sequential</span><span class="p">(</span>
<span class="n">nn</span><span class="o">.</span><span class="n">DropOut</span><span class="p">(</span><span class="mf">0.2</span><span class="p">),</span> <span class="c1"># Dropout layer to mimic noisy data</span>
<span class="n">nn</span><span class="o">.</span><span class="n">Dropout</span><span class="p">(</span><span class="mf">0.2</span><span class="p">),</span> <span class="c1"># Dropout layer to mimic noisy data</span>
<span class="n">nn</span><span class="o">.</span><span class="n">Conv2d</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="n">kernel_size</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">stride</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">padding</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
<span class="n">nn</span><span class="o">.</span><span class="n">ReLU</span><span class="p">(),</span>
<span class="n">nn</span><span class="o">.</span><span class="n">Conv2d</span><span class="p">(</span><span class="mi">16</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="n">kernel_size</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">stride</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">padding</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
Expand All @@ -1198,70 +1239,23 @@ <h1>Denoising auto-encoder<a class="headerlink" href="#denoising-auto-encoder" t
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Model: &quot;sequential_15&quot;
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
encoder_cnn (Sequential) (None, 3, 3, 64) 23296
_________________________________________________________________
decoder_cnn (Sequential) (None, 28, 28) 23233
=================================================================
Total params: 46,529
Trainable params: 46,529
Non-trainable params: 0
_________________________________________________________________
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Instantiate the model</span>
<span class="n">model_denoised_CNNAE</span> <span class="o">=</span> <span class="n">DenoiseCNNAE</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="n">loss</span><span class="p">,</span> <span class="n">loss_val</span><span class="p">)</span> <span class="o">=</span> <span class="n">train</span><span class="p">(</span><span class="n">DenoiseCNNAE</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span><span class="n">loaded_train</span><span class="p">,</span> <span class="n">loaded_test</span><span class="p">)</span>
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="n">loss</span><span class="p">,</span> <span class="n">loss_val</span><span class="p">)</span> <span class="o">=</span> <span class="n">train</span><span class="p">(</span><span class="n">model_denoised_CNNAE</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span><span class="n">loaded_train</span><span class="p">,</span> <span class="n">loaded_test</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Epoch 1/20
1719/1719 [==============================] - 25s 14ms/step - loss: 0.2551 - val_loss: 0.2533
Epoch 2/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2565 - val_loss: 0.2543
Epoch 3/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2554 - val_loss: 0.2525
Epoch 4/20
1719/1719 [==============================] - 25s 14ms/step - loss: 0.2551 - val_loss: 0.2531
Epoch 5/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2557 - val_loss: 0.2524
Epoch 6/20
1719/1719 [==============================] - 27s 16ms/step - loss: 0.2550 - val_loss: 0.2526
Epoch 7/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2552 - val_loss: 0.2539
Epoch 8/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2549 - val_loss: 0.2521
Epoch 9/20
1719/1719 [==============================] - 26s 15ms/step - loss: 0.2558 - val_loss: 0.2527
Epoch 10/20
1719/1719 [==============================] - 25s 15ms/step - loss: 0.2552 - val_loss: 0.2524
Epoch 11/20
1719/1719 [==============================] - 25s 15ms/step - loss: 0.2548 - val_loss: 0.2525
Epoch 12/20
1719/1719 [==============================] - 25s 15ms/step - loss: 0.2564 - val_loss: 0.2523
Epoch 13/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2556 - val_loss: 0.2522
Epoch 14/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2550 - val_loss: 0.2520
Epoch 15/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2550 - val_loss: 0.2524
Epoch 16/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2553 - val_loss: 0.2526
Epoch 17/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2541 - val_loss: 0.2533
Epoch 18/20
1719/1719 [==============================] - 23s 14ms/step - loss: 0.2550 - val_loss: 0.2520
Epoch 19/20
1719/1719 [==============================] - 22s 13ms/step - loss: 0.2555 - val_loss: 0.2519
Epoch 20/20
1719/1719 [==============================] - 23s 13ms/step - loss: 0.2550 - val_loss: 0.2540
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[Epoch 1] train loss: 0.612 - val loss: 0.585
</pre></div>
</div>
</div>
Expand All @@ -1273,7 +1267,7 @@ <h1>Denoising auto-encoder<a class="headerlink" href="#denoising-auto-encoder" t
</div>
</div>
<div class="cell_output docutils container">
<img alt="../_images/mlgeo_4.6_AutoEncoder_24_0.png" src="../_images/mlgeo_4.6_AutoEncoder_24_0.png" />
<img alt="../_images/mlgeo_4.6_AutoEncoder_25_0.png" src="../_images/mlgeo_4.6_AutoEncoder_25_0.png" />
</div>
</div>
</section>
Expand Down
Loading

0 comments on commit 4294dd6

Please sign in to comment.