Initial commit: MLP regularization, CNN BatchNorm comparison, autoencoder denoising
19
docs/Autoencoder-Denoising.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Autoencoder Image Denoising — MNIST
|
||||
|
||||
## Setup
|
||||
|
||||
A minimal fully-connected autoencoder: `Input(784) → Dense(32, relu) → Dense(784, sigmoid)`. Gaussian noise (factor 0.5) is added to MNIST digits, and the network is trained to reconstruct the *original clean* image from the noisy input — binary crossentropy loss between reconstruction and ground truth.
|
||||
|
||||
## Why a 32-unit bottleneck matters
|
||||
|
||||
Compressing a 784-pixel image down to 32 values and then reconstructing it forces the network to learn which features actually matter for representing a digit, rather than memorizing pixels. If the reconstruction still looks like a recognizable digit after that bottleneck, it's evidence the encoder learned a genuinely useful compressed representation.
|
||||
|
||||
## Result
|
||||
|
||||

|
||||
|
||||
Despite the aggressive compression (784 → 32 → 784), the reconstructions are clearly recognizable digits — the noise is substantially removed and the core digit shape is preserved.
|
||||
|
||||
## Notebook
|
||||
|
||||
[`encoder-noisy-image.ipynb`](../autoencoder-denoising/encoder-noisy-image.ipynb)
|
||||
31
docs/CNN-BatchNorm.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# CNN BatchNorm Comparison — MNIST
|
||||
|
||||
## Setup
|
||||
|
||||
A baseline CNN (`Conv2D(32) → Conv2D(64) → Flatten → Dense(10, softmax)`) compared against the identical architecture with BatchNormalization inserted after each conv layer. Both models use the same optimizer and learning rate (SGD, lr=0.001) — BatchNorm is the only variable that changed, making this a clean ablation.
|
||||
|
||||
## Training curves
|
||||
|
||||
**Baseline CNN:**
|
||||
|
||||

|
||||
|
||||
**CNN + BatchNorm:**
|
||||
|
||||

|
||||
|
||||
The BatchNorm version's curve drops faster and settles lower — visible directly in the training dynamics, not just the final number.
|
||||
|
||||
## Results
|
||||
|
||||
| Model | Test loss |
|
||||
|---|---|
|
||||
| Baseline CNN | 0.289 |
|
||||
| CNN + BatchNorm | 0.094 |
|
||||
|
||||
Since the optimizer and learning rate were held constant, this ~3x reduction in test loss is attributable to BatchNormalization itself — consistent with its known role in stabilizing gradients and accelerating convergence.
|
||||
|
||||
## Notebooks
|
||||
|
||||
- [`conv-pred.ipynb`](../cnn-batchnorm-comparison/conv-pred.ipynb)
|
||||
- [`conv-pred-BN.ipynb`](../cnn-batchnorm-comparison/conv-pred-BN.ipynb)
|
||||
9
docs/Home.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Deep Learning Portfolio — Documentation
|
||||
|
||||
Deep dives into each experiment: architecture, training configuration, and results — illustrated with real plots from the notebooks.
|
||||
|
||||
## Projects
|
||||
|
||||
- [MLP Regularization](MLP-Regularization.md) — Dropout comparison (with an honest note on a confounded variable)
|
||||
- [CNN BatchNorm Comparison](CNN-BatchNorm.md) — clean ablation, BatchNorm's effect isolated
|
||||
- [Autoencoder Denoising](Autoencoder-Denoising.md) — noisy-to-clean image reconstruction through a compressed bottleneck
|
||||
41
docs/MLP-Regularization.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# MLP Regularization — MNIST
|
||||
|
||||
## Setup
|
||||
|
||||
A baseline multilayer perceptron (`Dense(500) → Dense(100) → Dense(10)`) compared against the same architecture with `Dropout(0.2)` added after each hidden layer.
|
||||
|
||||
## ⚠️ Two variables changed, not one
|
||||
|
||||
Before looking at the results: the baseline uses SGD at `lr=0.001`, while the dropout run uses SGD at `lr=0.01` — a 10x higher learning rate, in addition to Dropout being added. This means the comparison below shows what happened between two different configurations, not the isolated effect of Dropout. A rigorous ablation would hold the learning rate constant. This is flagged directly rather than presenting a confounded result as clean evidence for Dropout's effect.
|
||||
|
||||
## Training curves
|
||||
|
||||
**Baseline:**
|
||||
|
||||

|
||||
|
||||
**With Dropout (and higher learning rate):**
|
||||
|
||||

|
||||
|
||||
## Where each model gets it wrong
|
||||
|
||||
**Baseline misclassifications:**
|
||||
|
||||

|
||||
|
||||
**Dropout version misclassifications:**
|
||||
|
||||

|
||||
|
||||
## Results
|
||||
|
||||
| Model | Test loss |
|
||||
|---|---|
|
||||
| Baseline (no dropout, lr=0.001) | 0.279 |
|
||||
| Dropout (0.2, lr=0.01) | 0.099 |
|
||||
|
||||
## Notebooks
|
||||
|
||||
- [`mnist-mlp-pred.ipynb`](../mnist-mlp-regularization/mnist-mlp-pred.ipynb)
|
||||
- [`mnist-mlp-pred-dropout.ipynb`](../mnist-mlp-regularization/mnist-mlp-pred-dropout.ipynb)
|
||||
BIN
docs/images/autoencoder-denoising-result.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
docs/images/cnn-baseline-loss.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/cnn-bn-loss.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
docs/images/mlp-baseline-loss.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/mlp-baseline-misclassified.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/images/mlp-dropout-loss.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
docs/images/mlp-dropout-misclassified.png
Normal file
|
After Width: | Height: | Size: 12 KiB |