Here is the algorithm for spiking neural network learning with Spike-Timing-Dependent Plasticity (STDP) to solve a classification task. Uploaded also are the results of applying this algorithm to the benchmark classification tasks of Fisher's Iris, Wisconsin breast cancer, and sklearn digits.
The algorithm is based on the STDP effect of mean output spiking rate stabilization. Each neuron is trained on its own class, and then is to distinguish its own class from the other classes. A more detailed explanation is in the paper
@Article{Sboev-MMA2020,
author = {Sboev, Alexander and Serenko, Alexey and Rybka, Roman and Vlasov, Danila},
title = {Solving a classification task by spiking neural network with {STDP} based on rate and temporal input encoding},
journal = {Mathematical Methods in the Applied Sciences},
year = {2020},
abbrev_source_title = {Math Meth Appl Sci},
abstract = {This paper develops local learning algorithms to solve a classification task with the help of biologically inspired mathematical models of spiking neural networks involving the mechanism of spike-timing-dependent plasticity (STDP). The advantages of the models are their simplicity and, hence, the potential ability to be hardware-implemented in low-energy-consuming biomorphic computing devices. The methods developed are based on two key effects observed in neurons with STDP: mean firing rate stabilization and memorizing repeating spike patterns. As the result, two algorithms to solve a classification task with a spiking neural network are proposed: the first based on rate encoding of the input data and the second based on temporal encoding. The accuracy of the algorithms is tested on the benchmark classification tasks of Fisher's Iris and Wisconsin breast cancer, with several combinations of input data normalization and preprocessing. The respective accuracies are 99\% and 94\% by F1-score.},
doi = {10.1002/mma.6241},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/mma.6241},
}
path_to_repository_root="`pwd`"
cd Iris/Gaussian_encoding/minmaxscale/models/output/best_genome
# or: cd Wisconsin/Gaussian_encoding/minmax/models/output/best_genome
# or: cd Digits/Gaussian_encoding/minmax/models/output/best_genome
# or any other dataset and preprocessing combination present
bash "$path_to_repository_root"/global_src/train_and_test.sh
- http://nest-simulator.org with Python3 bindings
- numpy
- scikit-learn (for sklearn.datasets)
(very resource-consuming!)
Put your environment-specific bootstrapping code in global_src/run_an_mpi_job.py, and then
path_to_repository_root="`pwd`"
cd Iris/Gaussian_encoding/minmaxscale
# or: cd Wisconsin/Gaussian_encoding/minmax
# or: cd Digits/Gaussian_encoding/minmax
# or any other dataset and preprocessing combination present
python "$path_to_repository_root"/global_src/genetic.py
global_src/
|- genetic.sh
| Just a wrapper that runs genetic.py.
|- genetic.py
| Reads the genetic algorithm parameters from src/parameters/,
| then creates models/genome*/parameters/
| with different SNN model parameters.
| In each genome*/, train_and_test.sh
| is invoked via run_an_mpi_job.py.
|- run_an_mpi_job.py
| A wrapper that runs train_and_test.sh.
| Needed because NEST requires each simulation
| be run in a separate process.
|- train_and_test.sh
| Runs split_data.py;
| then, for each fold and for each neuron separately,
| runs sim.py for the actual simulation;
| then, for each fold, runs get_accuracy.py.
|- split_data.py
| Reads parameters/,
| creates fold*/{train|test}_data.
|- sim.py
| Simulates training or testing of one neuron.
| Reads parameters/ for network model constants
| and input/ for the input spike rates.
|- get_accuracy.py
| Reads fold*/Testing/neuron*-freqs_{train|test}.txt,
| decodes the output spike rates into class labels.
|- get_fitness.py
| A placeholder that just outputs the accuracy
| of the spiking network as the specimen's fitness.
|- testsuite/
| Scripts that set the parameters so that
| to run the shortest simulation possible
| and then check if it quits normally.
|- visualization/
| | Some scripts for analysis of the results.
| | Of some interest is
| |- feed_to_GBM.py
| Run from a directory where a trained network saved
| its fold*/ directories,
| it trains an sklearn Gradient Boosting classifier
| on the output rates of the trained spiking network.
Dataset name: {Iris|Wisconsin|Digits}
|- Whether preprocessing with Gaussian receptive fields is used: {Direct_encoding|Gaussian_encoding}/
|- Input data normalization: {L2|minmaxscale|L2+minmax}/
|- src/
| Parameters of the MultiNEAT genetic algorithm
|- models/
|- genome*/
| Temporary directories where simulations store their data
|- output/
|- best_genome/
| The best of genome*/ is saved here after the genetic search.
|- parameters/
| Spiking network parameters
| optimal for this dataset and preprocessing combination,
| found by the genetic algorithm.
|- {train|test}_accuracies.txt
Accuracies of five cross-validation folds
on the training or the testing set, respectively.