miniMNIST-c This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire imp…
miniMNIST-c This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire imp…
This project implements a minimal neural network in C for classifying handwritten digits from the MNIST dataset. The entire implementation is ~200 lines of code and uses only the standard C library.
…train-images.idx3-ubytetrain-labels.idx1-ubytegcc -O3 -march=native -ffast-math -o nn nn.c -lmPlace the MNIST dataset files in the data/ directory.
Compile the program.
Run the executable:
./nnThe program will train the neural network on the MNIST dataset and output the accuracy and average loss for each epoch.
You can adjust the following parameters in nn.c:
HIDDEN_SIZE: Number of neurons in the hidden layerLEARNING_RATE: Learning rate for SGDEPOCHS: Number of training epochsBATCH_SIZE: Mini-batch size for trainingTRAIN_SPLIT: Proportion of data used for training (the rest is used for testing)This project is open-source and available under the MIT License.
No open issues yet, or sync has not completed.