Skip to content

Implementation from scratch of fully connected neural networks trainable through SGD with backpropagation

License

Notifications You must be signed in to change notification settings

AlexPasqua/NNs-from-scratch

Repository files navigation

Neural networks from scratch

Project for the Machine Learning course @ University of Pisa

Overview

  1. Short description
  2. Directory structure
  3. Quick start

Description

This project contains the implementation from scratch of neural networks for classification and regression trained with Stochastic Gradient Descent with back-propagation.
For more detailed information check the report

Directory structure (only main elements)

ML-project
  │── src
  │    │── network.py
  │    │── layer.py
  │    │── functions.py
  │    │── optimizers.py
  │    │── model_selection.py
  │    │── weights_initializations.py
  │    └── demo.py
  └── datasets
  │    └── cup
  │    │   │── ML-CUP20-TR.csv
  │    │   │── ML-CUP20_TS.csv
  │    │   │── CUP-DEV-SET.csv
  │    │   └── CUP-INTERNAL-TEST.csv
  │    └── monks
  │        │── monks.names       # description file
  │        │── monks-x.train     # the 'x' is the number of the dataset (1, 2, 3)
  │        └── monks-x.test
  └── plots
  │   │── ensemble      # where the plots of the constituent models go
  │   └── monks         # where the plots of the monks are
  └── results           # json files with the results of grid searches
  └── ensemble_models   # json files with the constituent models of the ensemble

Quick start

Install Python:
sudo apt install python3

Install pip:
sudo apt install --upgrade python3-pip

Install requirements:
python -m pip install --requirement requirements.txt

MONKS demo: open the script to find information and instructions. Then execute it with

cd src/
python demo.py