An interactive Streamlit visualizer for teaching Neural Networks from scratch (e.g., MNIST digit classification).
Clone the repository:
git clone https://github.com/Reinforce-SST/Reinforce-Sandbox-1-Math-Neural-Networks.git
cd Reinforce-Sandbox-1-Math-Neural-Networks
uv syncRun the Streamlit application using uv:
uv run main.pyTo install uv:
python -m pip install pipx # OR python3 -m pip install pipx
pipx ensurepath
pipx install uvTo install git and python:
Windows
winget install --id Git.Git -e --source winget;
winget install --id Python.Python.3 -e --source wingetMacOS
brew install git
brew install pythonLinux (Ubuntu/Debian)
sudo apt update
sudo apt install git -y
sudo apt install python3 -y
sudo apt install python3-pip -y-
Integrated Training Dashboard:
- Configure hyperparameters directly from the sidebar: Hidden layers architecture (
128 -> 32,256 -> 128, etc.), Activation (SIGMOID,RELU,TANH), Learning Rate, Epochs, Batch Size, Optimizer (MINI_BATCH,SGD,GD), and Loss Function (LOG_LOSS,MSE). - Click "
▶️ Start Training" to train epoch-by-epoch with real-time progress bars, live loss & accuracy curves, and final test evaluation on the MNIST dataset.
- Configure hyperparameters directly from the sidebar: Hidden layers architecture (
-
Drawing Surface (280×280 px):
- Draw digits (0–9) on the interactive HTML5 canvas with adjustable brush sizes.
-
28×28 Grayscale Downscaled View:
- Real-time downscaled
$28 \times 28$ matrix (normalized to$[0.0, 1.0]$ ) that is fed directly intoNeuralNetwork.forward(x).
- Real-time downscaled
-
Live Inference & Probability Breakdown:
- Real-time predicted digit, confidence percentage, top-3 candidates, and class probability distribution bar chart (0–9).
-
Model & Layer Inspector:
- Inspect layer dimensions, weight/bias matrix shapes, and live hidden layer activation values for drawn digits.