This project features a minimal neural network implementation in Rust for classifying handwritten digits from the MNIST dataset. The implementation utilizes only the standard Rust library and fastrand
for random number generation.
It is inspired from miniMNIST-c
- Two-layer neural network architecture (input → hidden → output)
- ReLU activation function for the hidden layer
- Softmax activation function for the output layer
- Cross-entropy loss function
- Stochastic Gradient Descent (SGD) optimizer
You can customize the following parameters in main.rs
:
HIDDEN_SIZE
: Number of neurons in the hidden layerLEARNING_RATE
: Learning rate for SGDEPOCHS
: Number of training epochsBATCH_SIZE
: Size of mini-batches for trainingTRAIN_SPLIT
: Proportion of data allocated for training (the remainder is used for testing)
This project is open-source and available under the MIT License.