This document provides a quick overview of how to get started with this deep learning project.
- Python 3.8 or higher
- 2GB free disk space (for dataset download)
- 4GB RAM (recommended)
pip install -r requirements.txtpython verify_setup.pyYou should see:
✓ Python Version: 3.x.x
✓ Checking dependencies:
✓ NumPy - OK
✓ Matplotlib - OK
✓ Scikit-learn - OK
✓ Checking project modules:
✓ utils - OK
✓ data_loader - OK
✓ mlp - OK
✓ autoencoder - OK
✓ rbm - OK
ALL CHECKS PASSED!
python train.pyThis will:
- Download Fashion-MNIST dataset (∼220MB)
- Train MLP for classification (∼2-3 minutes)
- Train Dense Autoencoder (∼2-3 minutes)
- Train RBM (∼3-4 minutes)
- Generate visualizations
- Total time: ∼10-15 minutes on CPU
Output files created in results/ directory:
training_history.png- Training curves for all modelsreconstructions.png- Autoencoder reconstruction examplesrbm_filters.png- Learned RBM filters
python evaluate.pyThis will:
- Run MLP evaluation with confusion matrix
- Analyze Autoencoder reconstruction error
- Analyze RBM feature learning
- Generate detailed performance reports
Additional output files:
mlp_confusion_matrix.png- Classification confusion matrixautoencoder_analysis.png- Reconstruction error distributionrbm_analysis.png- Feature activation analysis
After running train.py, you should see:
[2/5] Training Multilayer Perceptron (MLP)...
Epoch 5/30 - Loss: 0.2543, Acc: 92.45% - Val Loss: 0.2651, Val Acc: 91.23%
Epoch 10/30 - Loss: 0.1876, Acc: 94.12% - Val Loss: 0.2145, Val Acc: 93.45%
...
Epoch 30/30 - Loss: 0.0987, Acc: 96.78% - Val Loss: 0.1654, Val Acc: 94.23%
✓ MLP Test Accuracy: 88.45%
[3/5] Training Dense Autoencoder...
Epoch 5/30 - Train Loss: 0.001234, Val Loss: 0.001567
...
✓ Autoencoder Test MSE: 0.000891
[4/5] Training Restricted Boltzmann Machine (RBM)...
Epoch 5/30 - Free Energy: -123.45
...
✓ RBM Test Reconstruction Error: 0.145234
d:\MLP(Leslie)\
├── utils.py # Core utility functions
├── data_loader.py # Fashion-MNIST loader
├── mlp.py # MLP implementation
├── autoencoder.py # Autoencoder implementation
├── rbm.py # RBM implementation
├── train.py # Main training script
├── evaluate.py # Evaluation script
├── verify_setup.py # Verification script
├── requirements.txt # Python dependencies
├── README.md # Full documentation
├── QUICKSTART.md # This file
└── results/ # Output directory (created after first run)
├── training_history.png
├── reconstructions.png
├── rbm_filters.png
├── mlp_confusion_matrix.png
├── autoencoder_analysis.png
└── rbm_analysis.png
Edit train.py to adjust:
# MLP Configuration (around line 63)
mlp = MLP(
input_size=784,
hidden_size=256, # Change from 128
output_size=10,
hidden_activation='relu',
learning_rate=0.01 # Change from 0.05
)
# Autoencoder Configuration (around line 88)
autoencoder = DenseAutoencoder(
input_size=784,
hidden_sizes=[512, 256], # Change from [256]
latent_size=32,
learning_rate=0.001, # Change as needed
activation='relu'
)
# RBM Configuration (around line 112)
rbm = RBM(
n_visible=784,
n_hidden=256, # Change from 100
learning_rate=0.001
)
# Training parameters (update all sections)
history_mlp = mlp.train(
X_train, y_train_onehot,
epochs=50, # Change from 30
batch_size=32, # Change from 64
)MLP:
# Try different hidden layer sizes
hidden_size = 256 # vs 128, 64, 512
hidden_activation = 'sigmoid' # vs 'relu'
learning_rate = 0.01 # vs 0.05, 0.1Autoencoder:
# Try different encoder/decoder depths
hidden_sizes = [512, 256, 128] # vs [256]
latent_size = 16 # vs 32, 64
sparse = True # Enable sparsityRBM:
# Try different hidden dimensions
n_hidden = 200 # vs 100, 50
cd_k = 5 # More Gibbs sampling stepsSolution: Run pip install -r requirements.txt again
Solution: Reduce batch_size in train.py (e.g., 32 instead of 64)
Solution:
- This is expected on CPU. Consider GPU if available.
- Reduce
epochsfor quicker testing - Reduce
batch_sizefor faster iteration
Solution:
- Check internet connection
- The dataset will be cached after first download
- Manual download: https://github.com/zalandoresearch/fashion-mnist
- ✓ Run
verify_setup.pyto ensure everything works - ✓ Run
train.pyto train all models - ✓ Run
evaluate.pyto see detailed analysis - ✓ Experiment with hyperparameters
- ✓ Study the code to understand implementations
- ✓ Check visualizations in
results/directory
- Modify network architectures in
mlp.py,autoencoder.py,rbm.py - Implement new activation functions in
utils.py - Add new metrics or loss functions
- Extend to other datasets
- Implement CNN or other architectures
- Deep Learning textbook: https://www.deeplearningbook.org/
- Fashion-MNIST paper: https://github.com/zalandoresearch/fashion-mnist
- NumPy documentation: https://numpy.org/doc/
- Matplotlib tutorial: https://matplotlib.org/
For issues or questions:
- Check README.md for detailed documentation
- Review code comments in implementation files
- Run evaluate.py to debug training
- Experiment with simpler configurations first
Happy Learning! 🚀