Skip to content
unsupervised learning of natural images -- à la SparseNet.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
database adding database / re-running notebooks Feb 23, 2018
probe re-running notebooks Feb 21, 2019
shl_scripts invibe > Feb 21, 2019
.gitignore changing name to SparseHebbianLearning Sep 26, 2018
LICENCE.txt making it a module May 6, 2015
README.rst invibe > Feb 21, 2019
index.ipynb re-running index Dec 6, 2018
requirements.txt re-running all notebooks Sep 7, 2018 re-running all notebooks Sep 7, 2018


Reproducible research : Python implementation of SparseHebbianLearning

Set of RFs after Sparse Hebbian Learning.


  • This is a collection of python scripts to test learning strategies to efficiently code natural image patches. This is here restricted to the framework of the SparseNet algorithm from Bruno Olshausen (

  • this has been published as Perrinet, Neural Computation (2010) (see ):

         Author = {Perrinet, Laurent U.},
         Title = {Role of homeostasis in learning sparse representations},
         Year = {2010}
         Url = {},
         Doi = {10.1162/neco.2010.05-08-795},
         Journal = {Neural Computation},
         Volume = {22},
         Number = {7},
         Keywords = {Neural population coding, Unsupervised learning, Statistics of natural images, Simple cell receptive fields, Sparse Hebbian Learning, Adaptive Matching Pursuit, Cooperative Homeostasis, Competition-Optimized Matching Pursuit},
         Month = {July},
  • all comments and bug corrections should be submitted to Laurent Perrinet at

  • find out updates on


  • Be sure to have dependencies installed:

    pip3 install -U SLIP
  • Then, either install the code directly:

    pip3 install git+
  • or if you wish to tinker with the code, download the code @ You may also grab it directly using the command-line:

    unzip -d SparseHebbianLearning/
    cd SparseHebbianLearning/
    ipython clean build install
    jupyter notebook
  • developpers may use all the power of git with:

    git clone


This piece of code is distributed under the terms of the GNU General Public License (GPL), check if you have not red the term of the license yet.


  • README.rst : this file
  • index.ipynb : an introduction as a notebook
  • src/shl_*.py : the class files
  • probe*.ipynb : the individual experiments as notebooks
  • database : the image files.


  • finalizing the code to reproduce the sparsenet algorithm
  • 2.0 - 2015-05-07:
  • 1.1 - 2014-06-18:
  • documentation
  • dropped Matlab support
  • 1.0 - 2011-10-27 : initial release
You can’t perform that action at this time.