Implementation with Learning-Tool

Implementation with Learning-Tool

The full Matlab code is contained in lsm/learning/demos/spike_train_classification/spike_class.m.

Defining the input distribution

Several input distributions are readly imlemented as Matlab objects. The class jittered_templates provides the kind of input we need for our task. The followin code line generates a jittered_templates object which produces single spike trains from 2 patterns with a jitter of 4ms:

   InputDist = jittered_templates('nChannels',1,'nTemplates',2,...
                                  'Tstim',0.5,'jitter',4e-3);

Creating the neural microcircuit model

The following code generates a sparsely connected network of leaky-integrate-and-fire neurons. The details of the network creation are the topic of the Circuit-Tool User Manual and thus not described here.

   % init the model
   nmc = neural_microcircuit;

   % add a pool of 135 leaky-integrate-and-fire neurons
   [nmc,p1]  = add(nmc,'Pool','origin',[1 1 1],'size',[3 3 15]);
   [nmc,pin] = add(nmc,'Pool','origin',[0 0 0],'size',[1 1 1],...
                   'type','SpikingInputNeuron','frac_EXC',1);

   % connect the input to the pools/pools
   nmc = add(nmc,'Conn','dest',p1,'src',pin,'Cscale',0.9,...
             'type','StaticSpikingSynapse','rescale',0,'Wscale',0.15,'lambda',Inf);

   % add recurrent connections within the pools
   nmc = add(nmc,'Conn','dest',p1,'src',p1,'lambda',2);

   % define the respones (i.e. what to record)
   nmc = record(nmc,'Pool',p1,'Field','spikes');

Creating the Training and Test inputs

Since we have defined the circuit model and the input distribution we can now simulate the circuit with inuts drawn from this distribution an collect a training and test set. After the simulations the spike responses are lowpass fitered and the states are samples every 25ms.

   % collect stimulus/response pairs for training
   [train_response,train_stimuli] = collect_sr_data(nmc,InputDist,500);

   % apply low-pass filter to spikes
   train_states  = response2states(train_response,[],[0:0.025:Tmax]); 

   % collect stimulus/response pairs for testing
   [test_response,test_stimuli] = collect_sr_data(nmc,InputDist,200);

   % apply low-pass filter to spikes
   test_states = response2states(test_response,[],[0:0.025:Tmax]);

Setting up to train the threshold gate

Everything which has to do with the training of a readout is encapsulated in the class external_readout. This object allows you to specify the target function (target filter) and the training algorithm (and several options for preprocessing). In our example we use pseudo invers methode (implemented in the class linear_classification to determine the parameters of the threshold gate. The target function which outputs 0 (1) for all sample times (see definition of the task) is implemented in the class segment_classification. Hence the code for setting up to train the threshold gate is rather short:

   readout{1} = external_readout(...
      'description','with linear classification',...
      'targetFunction',segment_classification,...
      'algorithm',linear_classification);

Do the training of the threshold gate

After everyting is set up properly we just need to start the training. Note that in the code below the function function train_readouts also measures the performance on the tes set.

   [trained_readouts, perf_train, perf_test] = train_readouts(...
                                readout,...
                                train_states,train_stimuli,...
                                test_states,test_stimuli);

Evaluation of the performance

After training we want to see how the network performs on indinivual test inputs:

   plot_readouts(trained_readouts,test_states,test_stimuli);

 
(C) 2003, Thomas Natschläger last modified 06/12/2006