SLAYER Parameter

This module provides a way to read the SLAYER configuration parameters from yaml file with dictionary like access. A typical yaml configuration file looks like this.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
simulation:
   Ts: 1.0
   tSample: 1450
neuron:

neuron:
   type:     SRMALPHA   # neuron type (available SRMALPHA, LOIHI)
   theta:    10         # neuron threshold
   tauSr:    1.0        # neuron time constant
   tauRef:   1.0        # neuron refractory time constant
   scaleRef: 2          # neuron refractory response scaling (relative to theta)
   tauRho:   1          # spike function derivative time constant (relative to theta)
   scaleRho: 1          # spike function derivative scale factor
layer:
   - {dim: 34x34x2, wScale: 0.5}
   - {dim: 16c5z}
   - {dim: 2a}
   - {dim: 64c3z}
   - {dim: 2a}
   - {dim: 512}
   - {dim: 10}
training:
   error:
      type: NumSpikes #ProbSpikes #NumSpikes
      tgtSpikeRegion: {start: 0, stop: 350}
      tgtSpikeCount:  {true: 60, false: 10}
   path:
      out:     Trained/
      in:      path_to_spike_files
      train:   path_to_train_list
      test:    path_to_test_list

For the neuron type LOIHI, more information is provided in SLAYER Loihi module.

class slayerSNN.slayerParams.yamlParams(parameter_file_path=None, dict=None)[source]

This class reads yaml parameter file and allows dictionary like access to the members.

Usage:

import slayerSNN as snn
netParams = snn.params('path_to_yaml_file')     # OR
netParams = yamlParams('path_to_yaml_file')

netParams['training']['learning']['etaW'] = 0.01
print('Simulation step size        ', netParams['simulation']['Ts'])
print('Spiking neuron time constant', netParams['neuron']['tauSr'])
print('Spiking neuron threshold    ', netParams['neuron']['theta'])

netParams.save('filename.yaml')