Skip to content

ebridges/minimal-neural-network

Repository files navigation

Minimal Neural Network

Note

This is derivative of an article on X with several other sources to fill out my background.

This is an implementation of a simple neural network using only the C standard library. It's trained with the MNIST archive of handwritten numbers. The trained model is saved off in a platform independent way to be used by a Python lambda that does actual predictions using a simple HTML/JS user interface.

It consists of three layers:

  • Input layer which accepts 28x28 pixel images flattened into a 784 dimensional vector.
  • Hidden layer containing 256 neurons.
  • Output layer containing 10 neurons -- one for each class of digit to be predicted.

Training

The model was trained with the dataset over 100 epochs. Based on that, it's clear that subsequent epochs past 50 don't increase the accuracy significantly.

Info

  • Neural network implemented & trained in ANSI C.
  • Plot generated using Python & Matplotlib.
  • User interface implemented in Javascript/HTML/CSS.
  • Prediction service implemented as a Python lambda.
  • Deployment to AWS using Terraform to create & configure lambdas & API gateway.

References

About

Minimal neural network implemented & trained in C.

Resources

License

Stars

Watchers

Forks

Languages