DEV Community

Cover image for C++ Neural Network in a Weekend
Jeremy Ong
Jeremy Ong

Posted on

C++ Neural Network in a Weekend

There are tons of ML/AI frameworks to choose from right now (Tensorflow, Keras, Pytorch, etc). However, sometimes, building things completely from scratch is still the best way to learn how something works. To help people seeking to to this, I created a neural network in a weekend in C++ without any external dependencies. No matrix libraries, no linear algebra subroutines, nada, zilch.

The code for the repository is here. I also wrote a paper tutorial walking through the math (the derivations) and the implementation hosted in the same repository here. The paper is... a bit on the long side at 42 pages, but it's meant to be entirely self-contained. Again, from scratch!

In addition, the code is pretty heavily annotated with comments, so should hopefully be easy to following along, but please leave a question/comment if you get stuck. Happy hacking!

Top comments (1)

Collapse
 
jeremyong profile image
Jeremy Ong

Also, while this is written in C++, you should be able to follow along in any language, so feel free to share it if you do :)