-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNote.txt
More file actions
29 lines (23 loc) · 1.04 KB
/
Note.txt
File metadata and controls
29 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
DEEP LEARNING: MNIST Digit Classification using a Multi-Layer Perceptron in PyTorch
Objective
This PROGRAM demonstrates how to build, train, and evaluate a simple two-layer MLP to classify handwritten digits from the MNIST dataset. Implemented in PyTorch, the model uses ReLU activation, batch normalization and cross-entropy loss to learn from grayscale images and predict digit classes with high accuracy.
1. Dataset: MNIST
- Contains 60,000 training and 10,000 test grayscale images of digits (0–9).
- Each image is 28×28 pixels.
- Each sample is a pair: (image, label).
2. Model Architecture
- A 2-layer MLP:
- First layer: `Linear(784 → N_HIDDEN)` → `BatchNorm` → `ReLU`
- Second layer: `Linear(N_HIDDEN → 10)`
- Output: Logits converted to class probabilities using Softmax.
3. Loss Function
- Uses Cross-Entropy Loss:
Encourages high confidence for the correct class.
4. Implementation Workflow
- Use `train.py` and `eval_classifier.py`.
5. How to Train
Run:
```bash
python train.py 128
```
(128 = number of hidden units in the MLP)