This project was developed on Windows using Git Bash.
Neural Network in C++ is a project I created to explore neural networks. Inspired by 3Blue1Brown's videos on neural networks, I set out to implement one myself to better understand how things fit together.
This project defines a neural network class with feature scaling, one-hot encoding, saving/loading the network. The layers and activation functions of the network can also be changed.
I have also included a Python notebook to generate sample data for the purposes of testing the network.
As it is currently, the main program takes the generated data, trains the network, tests the network on the test set, and saves the network details to a file.
- MingGW
- Install package for compiling C++
- CMake
- Make (makefiles)
- For Windows:
winget install GnuWin32.Make
, then addC:\Program Files (x86)\GnuWin32\bin
to PATH
- For Windows:
- Python (for generating sample data)
- Clone nlohmann json in
./lib
- Create a
CMakeLists.txt
file in./lib
with this code:add_subdirectory(json)
- Create a folder for build files
./build
- Obtain sample data.
generate_data.ipynb
generates some simple data for classification.
cd build
cmake .. -G "MinGW Makefiles"
make
The executable is created at ./build/neuralnet.exe
.
- CMake creates Makefiles, you only need to run CMake when you change CMakeLists.
- Makefiles are what define how to compile stuff. Run
make
when you change source code and want to recompile. - Pls remember to start ssh agent before trying to pull/push.
- Integrate the feature scaler into the network class; they don't need to be separate
- Test function can also go into the network class
- May need testing for loading a saved network.