项目作者: SimoneGasperini

项目描述 :
Unsupervised neural networks with biological-inspired learning rules
高级语言: Python
项目地址: git://github.com/SimoneGasperini/biolearn.git
创建时间: 2020-12-18T22:07:33Z
项目社区:https://github.com/SimoneGasperini/biolearn

开源协议:

下载


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:

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

Then, install the prerequisites using pip:

  1. cd biolearn
  2. pip install -r requirements.txt

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

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

  1. from sklearn.datasets import fetch_openml
  2. # Download and normalize MNIST dataset
  3. X, y = fetch_openml(name='mnist_784', version=1, data_id=None, return_X_y=True)
  4. X *= 1. / 255
  5. from biolearn.model.bcm import BCM
  6. from biolearn.utils.activations import Relu
  7. from biolearn.utils.optimizer import Adam
  8. # Build and fit the model
  9. model = BCM(outputs=100, num_epochs=20, batch_size=1000, activation=Relu(), optimizer=Adam())
  10. model.fit(X)

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

  1. from biolearn.utils.misc import view_weights
  2. 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.