LaplaceXD / mnist-neural-network

A neural network for the MNIST digits dataset in C.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MNIST Neural Network in C

A small project that was inspired by Mark Kraay's Video, where he created a Neural Network from Scratch in C. This led me to a rabbit hole in machine learning, where I started learning about the mathematics behind machine learning, forward propagation, backward propagation, neural network architecture, and so on. Now, it would be boring if all I learned are theories, thus I wanted to try making my own rendition of a Neural Network in C, using the MNIST digit dataset.

Usage

  • Install a C compiler, preferably GCC.
  • [Optional] Install Make to make use of MakeFile and instantly compile binaries.

Without MakeFile:

mkdir output
gcc lib/stats.c -o output/stats.o -c
gcc lib/matrix.c -o output/matrix.o -c
gcc lib/doubly_ll.c -o output/doubly_ll.o -c
gcc lib/image_set.c -o output/image_set.o -c
gcc lib/neural_net.c -o output/neural_net.o -c
gcc lib/ml.c -o output/ml.o -c
gcc main.c -o output/main.o -c
cd output
gcc -o ../mnist main.o stats.o matrix.o doubly_ll.o image_set.o neural_net.o ml.o
cd ..
rm -rf output

With MakeFile:

make

You can then run the compiled mnist.exe program using by typing in the console: ./mnist or make run if MakeFile is installed.

Libraries Created

There are currently 6 libraries that I created for this project. They are completely reusable depending on the needs of your project. However, do take note of their header files and dependencies when copying. The documentation for the functions stored in these libraries can be found in their respective header files.

Library Dependencies Description
stats none A utility library which contains different statistical functions.
matrix none A library for working with matrices.
doubly_ll none A library for working with doubly linked list.
image_set matrix, ml A library for working with the MNIST digit dataset.
neural_net matrix, doubly_ll A library for creating and working with neural networks.
ml matrix, stats, neural_net A library for training and testing neural networks against a dataset.

Bibliography

License

MIT

About

A neural network for the MNIST digits dataset in C.

License:MIT License


Languages

Language:C 98.0%Language:Makefile 2.0%