- Implement a neural network in C++ without the use of advanced libraries or frameworks.
- Train it on the supplied Fashion-MNIST dataset using a backpropagation algorithm.
Fashion MNIST (https://arxiv.org/pdf/1708.07747.pdf) - a modern version of a well-known MNIST (http://yann.lecun.com/exdb/mnist/). It is a dataset of Zalando's article images ‒ consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. The dataset is in CSV format. There are four data files included:
fashion_mnist_train_vectors.csv- training input vectorsfashion_mnist_test_vectors.csv- testing input vectorsfashion_mnist_train_labels.csv- training labelsfashion_mnist_test_labels.csv- testing labels
src/
├── data/
│ ├── dataset.cpp
│ └── dataset.hpp
├── matrix/
│ ├── exceptions.hpp
│ ├── matrix.cpp
│ ├── matrix.hpp
│ └── printer.hpp
├── network/
│ ├── activation.hpp
│ ├── helpers.cpp
│ ├── helpers.hpp
│ ├── linear.cpp
│ ├── network.cpp
│ ├── network.hpp
│ ├── optimiser.cpp
│ └── optimiser.hpp
├── parser/
│ ├── csv.cpp
│ └── csv.hpp
├── tests/
│ ├── csv_tests.cpp
│ ├── matrix_tests.cpp
│ └── tests.hpp
├── constants.cpp
├── constants.hpp
└── main.cpp
Before running the code for the first time, please, download the dataset from Google Drive using download.sh.
Note: You need gdown for the downloader, if you do not have it install it using pip install gdown
Then, use the run.sh script to compile, run, and evaluate the code.
If you wish to change any hyperparameter, the optimizer, or the architecture of the neural network, you can do so manually in src/main.cpp.
The framework expects data to be in the same format as the dataset in data/.
The models achieve ~90% accuracy on the test set with only a minute of training time.