Code Monkey home page Code Monkey logo

hebbian-learning-cnn's Introduction

Pytorch implementation of Hebbian learning algorithms to train deep convolutional neural networks. A neural network model is trained on CIFAR10 both using Hebbian algorithms and SGD in order to compare the results. Although Hebbian learning is unsupervised, I also implemented a technique to train the final linear classification layer using the Hebbian algorithm in a supervised manner. This is done by applying a teacher signal on the final layer that provides the desired output; the neurons are then enforced to update their weights in order to follow that signal.

In order to launch a training session, type:
PYTHONPATH=<project root> python <project root>/train.py --config <config family>/<config name>
Where <config family> is either gdes or hebb, depending whether you want to run gradient descent or hebbian training, and <config name> is the name of one of the training configurations in the config.py file.
Example:
PYTHONPATH=<project root> python <project root>/train.py --config gdes/config_base
To evaluate the network on the CIFAR10 test set, type:
PYTHONPATH=<project root> python <project root>/evaluate.py --<config family>/<config name>

The experiments were performed in the following environment:
Google CoLaboratory
Python version: 3.6
Pytorch version: 1.0.0
Torchvision version: 0.2.1 (N.B. With successive versions you will get an error at line 27 of the data.py file, which can be corrected by replacing cifar10.train_data with cifar10.data, and at line 75 of the same file, which can be corrected by passing an extra argument torch.zeros(zca.size(1)) to LinearTransform)

For further details, please refer to my thesis work (N.B. The latest updates might not be covered in this document): "Hebbian Learning Algorithms for Training Convolutional Neural Networks - Gabriele Lagani"
Link: https://drive.google.com/file/d/1Mo-AKTzm5k3hcnO6UkVpNp0Ce0M-U7zc/view?usp=sharing

Author: Gabriele Lagani - [email protected]

hebbian-learning-cnn's People

Contributors

gabrielelagani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.