Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laplacexd/mnist-neural-network
A neural network for the MNIST digits dataset in C.
https://github.com/laplacexd/mnist-neural-network
c mnist neural-network
Last synced: about 2 months ago
JSON representation
A neural network for the MNIST digits dataset in C.
- Host: GitHub
- URL: https://github.com/laplacexd/mnist-neural-network
- Owner: LaplaceXD
- License: mit
- Created: 2022-06-13T04:02:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T02:29:58.000Z (over 2 years ago)
- Last Synced: 2023-03-07T12:53:42.580Z (almost 2 years ago)
- Topics: c, mnist, neural-network
- Language: C
- Homepage:
- Size: 142 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# MNIST Neural Network in C
A small project that was inspired by [Mark Kraay's Video](https://www.youtube.com/watch?v=ReOxVMxS83o), 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](https://git-disl.github.io/GTDLBench/datasets/mnist_datasets/).
## Usage
- Install a C compiler, preferably [GCC](https://sourceforge.net/projects/mingw-w64/).
- **[Optional]** Install [Make](https://sourceforge.net/projects/ezwinports/files/make-4.3-without-guile-w32-bin.zip/download) to make use of `MakeFile` and instantly compile binaries.Without `MakeFile`:
```bash
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`:
```bash
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
- [3Blue1Brown - Deep Learning Series](https://www.youtube.com/watch?v=aircAruvnKk&list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi&index=1) - Very intuitive look into neural networks and machine learning.
- [Neural Networks/Deep Learning](https://www.youtube.com/playlist?list=PLblh5JKOoLUIxGDQs4LFFD--41Vzf-ME1) - This playlist is what made it click for me, especially in understanding back propagation.
- [Gradient Descent](https://vitalflux.com/gradient-descent-explained-simply-with-examples/)
- [Samson Zhong - Building a Neural Network From Scratch (Numpy & Maths)](https://www.youtube.com/watch?v=w8yWXqWQYmU&t=1612s)
- [Neural Network from Scratch | Mathematics & Python Code](https://www.youtube.com/watch?v=pauPCy_s0Ok)
- [Normalization VS Standardization of Data](https://stackoverflow.com/questions/63746182/correct-way-of-normalizing-and-scaling-the-mnist-dataset)
- [What is a Makefile and how does it work?](https://opensource.com/article/18/8/what-how-makefile)
- [Weight Initialization Techniques in Neural Networks](https://towardsdatascience.com/weight-initialization-techniques-in-neural-networks-26c649eb3b78)
- [Bias Initialization in a Neural Network](https://medium.com/@glenmeyerowitz/bias-initialization-in-a-neural-network-2e5d26fed0f0)
- [Activation Functions](https://ml-cheatsheet.readthedocs.io/en/latest/activation_functions.html)
## License
[MIT](https://github.com/LaplaceXD/mnist-neural-network/blob/master/LICENSE)