Giter Site home page Giter Site logo

simonmichau / sequence-learning Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 19.48 MB

A neuroscientific sequence learning model on spiking neural networks with winner-take-all circuits and lateral inhibition. Written using the NEST neural simulator and custom neuron/synapse models.

License: MIT License

TeX 26.79% Python 45.57% CMake 1.91% C++ 25.73%
nest sequence-learning spiking-neural-network winner-take-all lateral-inhibition simulation

sequence-learning's Introduction

Sequence learning

This repository contains the code base for the bachelor's thesis "Dynamic memory traces for sequence learning in spiking networks" at RWTH Aachen University/FZ Juelich INM-6 (Computation in Neural Circuits Group).

Overview

  • klampfl-maass contains the original code base for "Emergence of Dynamic Memory Traces in Cortical Microcircuit Models through STDP" (2013) that was replicated with NEST here
  • neuron-synapse-model contains the custom neuron and synapse model for NEST that is required to run the simulation correctly
  • sequence-learning is the actual Python package that contains the code for this project
  • thesis contains the LaTeX source code of the corresponding thesis, along the thesis as pdf

Requirements

In order to run the sequence-learning package, NEST (ideally master@7086c3cab) is required, as well as the Python packages from requirements-NEST.txt. It is recommended to use conda/miniconda for this. The neuron-synapse-model may also need to be compiled using make -j 4 install.

Getting Started

To get started, you can find in the sequence-learning package an example.py file that shows a use-case example. Also try running it to verify your installation is working correctly.

First of all (after importing the package) the NEST simulator needs to be initialized and the custom neuron and synapse model needs to be imported and installed by running

nest_init()

To create a new Network object use

grid = Network(grid_shape=(10,5), k_min=2, k_max=10, n_inputs=100)

This creates a 2D grid of dimension grid_shape with each point on that grid representing a WTA circuit with a random number of neurons, drawn uniformly from [k_min, k_max]. The number of input channels is denoted by n_inputs. Many other parameters of the Network object can be manipulated. To find out more you can check out the code documentation within the Network class. It is also possible to visualize the Network grid both as a 2D colormesh and a 3d barchart using

grid.visualize_circuits()

and

grid.visualize_circuits_3d_barchart()

respectively.

Grid Visualization

Grid Visualization 3D

Before actually running the Network the max_neuron_gid has to be set to the maximum global id of the Networks NodeCollection to ensure proper interaction between the Python code and the NEST kernel.

grid.get_node_collections().max_neuron_gid = max(grid.get_node_collections().global_id)  # critical

A new InputGenerator object for the Network can be set up by running

inpgen = InputGenerator(grid, r_noise=5, r_input=5, r_noise_pattern=2, use_noise=True, t_noise_range=[500.0, 800.0],
                        n_patterns=2, t_pattern=[300.]*2, pattern_sequences=[[0],[1]])

As with the Network class, the InputGenerator class documentation can be checked out for more information. In this example, the noise, input and noise-pattern firing rates (r_noise, r_input, r_noise_pattern) are set, as well as the time span from which the noise will be randomly drawn (t_noise_range). The patterns that will be produced by the InputGenerator are described by how many distinct patterns should exist (n_patterns), how long the duration of each of these patterns should be (t_pattern), and which sequences from these patterns should be run.

To run the actual simulation and record from it, a Recorder object is required

recorder = Recorder(grid, save_figures=False, show_figures=True, create_plot=False)

The properties of the recorder can be set while the simulation is not running by recorder.set(). E.g.:

recorder.set(create_plot=True)

To run a simulation and also obtain the id's of the recorded neurons run

id_list = recorder.run_network(inpgen=inpgen, t_sim=3000, dt_rec=None, title="Test #1", train=True, order_neurons=False)

The id_list can later be used to record from the same neurons as in previous simulation runs. To learn more about the different ways of sampling neurons to record from check out the documentation of the run_network() function. Sampling is especially useful when dealing with larger networks that can take up significant time for plotting etc. The simulation time in ms is set by t_sim, and the time intervals in which EPSPs and weights should be recorded are given by dt_rec. It can also be decided if the Network should be allowed to learn during the simulation run or not (STDP on/off). To make neuron assemblies visible more easily order_neurons should be set to True to order the spike traces by mean activation time.

Examples

The following image shows the results of a 3s test after a 100s training phase on a $10\times 5$ grid with 2-10 neurons per WTA circuit. Training and test input consisted of 5Hz noise (black)/pattern (red) spikes with an additional 2Hz of noise laid over during pattern presentation phase. Example result

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.