tutorials:writing_your_own_plasticity_model
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:writing_your_own_plasticity_model [2015/01/23 21:10] – zenke | tutorials:writing_your_own_plasticity_model [2018/02/07 23:11] (current) – Adds final paragraph on unit tests zenke | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **Under construction!** Please note, I only have started writing this tutorial. | ||
- | |||
- | |||
====== Synapse and Plasticity Models ====== | ====== Synapse and Plasticity Models ====== | ||
Auryn was written with the aim to simplify the development of spike-timing-dependent plasticity (STDP) models and to run them efficiently in distributed network simulations. Behind the scenes Auryn diverts from existing standard simulators (like NEST) in that it has the inbuilt functionality to back-propagate action potentials to the presynaptic neurons. This largely simplifies implementing plasticity models which can be written as the product of "some synaptic quantities" | Auryn was written with the aim to simplify the development of spike-timing-dependent plasticity (STDP) models and to run them efficiently in distributed network simulations. Behind the scenes Auryn diverts from existing standard simulators (like NEST) in that it has the inbuilt functionality to back-propagate action potentials to the presynaptic neurons. This largely simplifies implementing plasticity models which can be written as the product of "some synaptic quantities" | ||
- | * Gerstner, W., and Kistler, W.M. (2002). Mathematical formulations of Hebbian learning. Biol Cybern 87, 404–415. [[http:// | + | * Gerstner, W., and Kistler, W.M. (2002). Mathematical formulations of Hebbian learning. Biol Cybern 87, 404–415. [[http:// |
- | * Zenke, F., and Gerstner, W. (2014). Limits to high-speed simulations of spiking neural networks using general-purpose computers. Front Neuroinform 8, 76. [[http:// | + | * Zenke, F., and Gerstner, W. (2014). Limits to high-speed simulations of spiking neural networks using general-purpose computers. Front Neuroinform 8, 76. [[http:// |
- | If you can write down a learning rule as a differential equation involving spike trains, synaptic traces and specific postsynaptic quantities, such as the membrane potential, Auryn will bring everything need to so so intuitively. Here is an example from Gerstner and Kistler (2002): | + | If you can write down a learning rule as a differential equation involving spike trains, synaptic traces and specific postsynaptic quantities, such as the membrane potential, Auryn will bring everything |
{{ : | {{ : | ||
- | In Auryn you can implement this type of learning rule very intuitively | + | In Auryn you can implement this type of learning rule if the '' |
Line 20: | Line 17: | ||
===== Understanding plasticity in Auryn ===== | ===== Understanding plasticity in Auryn ===== | ||
- | Before writing | + | In most cases you will want to use Auryn to implement |
- | + | ||
- | In most cases it will be best to writing your own synapse model, by modifying an existing model (like [[examples:sim_background|Triplet STDP]]) which already | + | |
Line 40: | Line 35: | ||
DEFAULT_TRACE_MODEL * tr_post_hom; | DEFAULT_TRACE_MODEL * tr_post_hom; | ||
</ | </ | ||
- | The macros '' | + | The macros '' |
- | This declaration should be matched in the '' | + | This declaration should be matched in the '' |
<code c++> | <code c++> | ||
/* Initialization of presynaptic traces */ | /* Initialization of presynaptic traces */ | ||
Line 52: | Line 47: | ||
tr_post_hom = dst-> | tr_post_hom = dst-> | ||
</ | </ | ||
- | which initializes the traces using their respective | + | which initializes the traces using their respective |
- | + | ||
- | The current value of a trace can then be accessed in the code via '' | + | |
==== Weight updates at spiking events (propagate) ==== | ==== Weight updates at spiking events (propagate) ==== | ||
- | The code described in the previous section ensures that you have a bunch of pre- and postsynaptic traces at your hands, but it does not implement any weight update. To do so you will have to implement the function '' | + | The code described in the previous section ensures that you have a bunch of pre- and postsynaptic traces at your hands, but it does not implement any weight update. To do so you will have to implement the function '' |
<code c++> | <code c++> | ||
void TripletConnection:: | void TripletConnection:: | ||
Line 72: | Line 65: | ||
By forward propagation we mean the actions that are triggered by a presynaptic spike postsynaptically. This includes on the one hand evoking a postsynaptic conductance, | By forward propagation we mean the actions that are triggered by a presynaptic spike postsynaptically. This includes on the one hand evoking a postsynaptic conductance, | ||
- | Let's have a look at how this is done in [[manual: | + | Let's have a look at how this is done in [[manual: |
<code c++> | <code c++> | ||
Line 118: | Line 111: | ||
return dw; | return dw; | ||
</ | </ | ||
- | The code describes how each weight should be updated upon a presynaptic spike (hence the suffix). Since spikes in Auryn are labelled | + | The code describes how each weight should be updated upon a presynaptic spike (hence the suffix). Since spikes in Auryn are labeled |
The complete weight update '' | The complete weight update '' | ||
- | This describes | + | One thing you should pay close attention to, because it could might easily introduce errors: **You need to translate postsynaptic IDs (as shown above)**, but not the presynaptic ones! Copies of presynaptic trances are available on each rank, whereas postsynaptic traces are distributed with the neuronal dynamics. This only makes a difference when you are running simulations in parallel with MPI, but then it's an important difference. |
+ | |||
+ | We now covered weight updates triggered by presynaptic spikes, but what happens upon a postsynaptic spike? | ||
=== Backward spike propagation === | === Backward spike propagation === | ||
Line 175: | Line 171: | ||
===== Changing the plasticity model ===== | ===== Changing the plasticity model ===== | ||
- | Suppose, you would like to change the plasticity model, all you need to do is to copy TripletConnection.h and TripletConnection.cpp to YourNameConnection.h and .cpp and then the '' | + | Most of the plasticity models in Auryn follow the design principles introduced above (e.g. http:// |
- | One thing you should pay attention to, because it could might easily introduce errors: You need to translate postsynaptic IDs (as shown above), but not the presynaptic ones! Copies of presynaptic trances are integrated on each rank; that sounds inefficient, | ||
==== Weight updates in continuous time (evolve) ==== | ==== Weight updates in continuous time (evolve) ==== | ||
Line 185: | Line 181: | ||
Let me give a simple example. For instance, the following code lets you iterate over all weights: | Let me give a simple example. For instance, the following code lets you iterate over all weights: | ||
<code c++> | <code c++> | ||
- | for (AurynLong i = 0 ; i < w-> | + | void TripletConnection:: |
+ | { | ||
+ | | ||
AurynWeight * weight = w-> | AurynWeight * weight = w-> | ||
// do something with the weight | // do something with the weight | ||
+ | } | ||
} | } | ||
</ | </ | ||
- | which could for instance be used to implement a weight decay. | + | which could for instance be used to implement a weight decay. |
<code c++> | <code c++> | ||
if ( sys-> | if ( sys-> | ||
for (AurynLong i = 0 ; i < w-> | for (AurynLong i = 0 ; i < w-> | ||
- | AurynWeight * weight = w->get_data(i); | + | AurynWeight * weight = w->get_data_ptr(i); |
// do something with the weight | // do something with the weight | ||
} | } | ||
Line 202: | Line 201: | ||
where you will have to define and initialize the variable time_scaling somewhere in your connection object. It will give you the new step width in multiples of Auryn' | where you will have to define and initialize the variable time_scaling somewhere in your connection object. It will give you the new step width in multiples of Auryn' | ||
+ | This should give you the necessary tools to start out with writing your own plasticity models. As with all code, write simple unit tests to ensure you are simulating what you want to simulate. Happy coding. |
tutorials/writing_your_own_plasticity_model.1422047455.txt.gz · Last modified: 2015/01/23 21:10 by zenke