Skip to content

Unsupervised neural networks with biological-inspired learning rules

Notifications You must be signed in to change notification settings

SimoneGasperini/biolearn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Biolearn

Unsupervised neural networks with biological-inspired learning rules

build docs

Prerequisites

The only requirements to successfully install, test, and use the biolearn package are the following:

  • numpy
  • matplotlib
  • scikit-learn
  • tqdm
  • pytest
  • hypothesis

This Python version guarantees a good integration with the other common Machine Learning tools provided by scikit-learn package. In this way you can use the biolearn as an equivalent alternative in other pipelines. Like other Machine Learning algorithms also the biolearn ones depend on many hyper-parameters, which have to be tuned according to the given problem.

Installation

To install the biolearn package, first you have to clone the repository:

git clone https://github.com/SimoneGasperini/biolearn.git

Then, install the prerequisites using pip:

cd biolearn
pip install -r requirements.txt

Finally, simply run the setup.py script to complete the installation:

python setup.py install

Usage

The biolearn classes provide the member function fit to train your model on data. Here, a simple example on MNIST digits dataset is shown.

from sklearn.datasets import fetch_openml

# Download and normalize MNIST dataset
X, y = fetch_openml(name='mnist_784', version=1, data_id=None, return_X_y=True)
X *= 1. / 255


from biolearn.model.bcm import BCM
from biolearn.utils.activations import Relu
from biolearn.utils.optimizer import Adam

# Build and fit the model
model = BCM(outputs=100, num_epochs=20, batch_size=1000, activation=Relu(), optimizer=Adam())
model.fit(X)

You can also visualize the synaptic weights using the utility function provided by the package:

from biolearn.utils.misc import view_weights

view_weights(model.weights, dims=(28, 28))

In the examples directory, some simple Jupyter notebooks are provided as quick tutorials, and the basic features about BCM model training are shown. Finally, in the online documentation, you can find a general presentation and the mathematical characterization of the models, together with classes API description and more complete examples.

Authors

See also the original complete repository plasticity (by Nico Curti), which provides a Cython wrap and the C++ implementation of the same models.

About

Unsupervised neural networks with biological-inspired learning rules

Topics

Resources

Stars

Watchers

Forks

Languages