This python code implemente the functional clustering algorithm (FCA) for spike trains hierarchical clustering.
The algorithm is described in Feldt S, Waddell J, Hetrick VL, Berke JD, Zochowski M (2009) Functional clustering algorithm for the analysis of dynamic network data. Phys Rev E Stat Nonlin Soft Matter Phys 79(5 Pt 2):056104
It works as follows:
- starts with n_trains spike trains to cluster
- create surrogate data by jittering spike train (n_surrogate of n_trains spike trains)
- compute the distance matrix - here a distance is given but any distance should work
- use the surrogate to create an empirical noise distribution
- compute the probability to obtain this distance according to the surrogate
- take the most significant pair of spike trains
- merge them and recompute the new surrogate data with the new spike trains set
- repeat 5 to 7 until either 5% threshold is reached
This code is in pure python and should work without dependency (except numpy). It therefore portable but very slow.
A simple example is given with obvious clustering (and of course the algorithm yields the expected result).
HAS