Skip to content

xhudec2/Neural-Networks

Repository files navigation

TASK

  • 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.

DATASET

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 vectors
  • fashion_mnist_test_vectors.csv - testing input vectors
  • fashion_mnist_train_labels.csv - training labels
  • fashion_mnist_test_labels.csv - testing labels

CODE STRUCTURE

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

FUNCIONALITY

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/.

RESULTS

The models achieve ~90% accuracy on the test set with only a minute of training time.

About

Neural Networks course project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •