Spike Pattern Detection and Evaluation (SPADE)

SPADE (Torre et al., 2013, Quaglio et al., 2017, Stella et al., 2019) is the combination of a mining technique and multiple statistical tests to detect and assess the statistical significance of repeated occurrences of spike sequences (spatio-temporal patterns, STP).

spade(spiketrains, bin_size, winlen[, ...])

Perform the SPADE (Torre et al., 2013), (Quaglio et al., 2017), (Stella et al., 2019) analysis for the parallel input spiketrains.

concepts_mining(spiketrains, bin_size, winlen)

Find pattern candidates extracting all the concepts of the context, formed by the objects defined as all windows of length winlen*bin_size slided along the discretized spiketrains and the attributes as the spikes occurring in each of the windows.

pvalue_spectrum(spiketrains, bin_size, ...)

Compute the p-value spectrum of pattern signatures extracted from surrogates of parallel spike trains, under the null hypothesis of independent spiking.

test_signature_significance(pv_spec, ...[, ...])

Compute the significance spectrum of a pattern spectrum.

approximate_stability(concepts, rel_matrix)

Approximate the stability of concepts.

pattern_set_reduction(concepts, ...[, ...])

Takes a list concepts and performs pattern set reduction (PSR).

concept_output_to_patterns(concepts, winlen, ...)

Construction of dictionaries containing all the information about a pattern starting from a list of concepts and its associated pvalue_spectrum.


Visualization of SPADE analysis is covered in Viziphant e.g.: viziphant.patterns.plot_patterns_statistics_all()

See Viziphant for more information:



This modules relies on the C++ implementation of the fp-growth algorithm developed by Forian Porrmann (available at https://github.com/fporrmann/FPG). The module replaces a more generic implementation of the algorithm by Christian Borgelt ( http://www.borgelt.net/pyfim.html) that was used in previous versions of Elephant.

If the module fim.so is not available in a precompiled format ( currently Linux/Windows) or cannot be compiled on a given system during install, SPADE will make use of a pure Python implementation of the fast fca algorithm contained in elephant/spade_src/fast_fca.py, which is significantly slower.

See Resolving compilation issues on how to install elephant without compiling the fim.so module.

See Also

elephant.cell_assembly_detection.cell_assembly_detection : another synchronous patterns detection


Given a list of Neo Spiketrain objects, assumed to be recorded in parallel, the SPADE analysis can be applied as demonstrated in this short toy example of 10 artificial spike trains of exhibiting fully synchronous events of order 10.

>>> import quantities as pq
>>> import numpy as np
>>> from elephant.spike_train_generation import compound_poisson_process
>>> from elephant.spade import spade

Generate correlated spiketrains.

>>> np.random.seed(30)
>>> spiketrains = compound_poisson_process(rate=15*pq.Hz,
...     amplitude_distribution=[0, 0.95, 0, 0, 0, 0, 0.05], t_stop=5*pq.s)

Mining patterns with SPADE using a bin_size of 1 ms and a window length of 1 bin (i.e., detecting only synchronous patterns).

>>> patterns = spade(spiketrains, bin_size=10 * pq.ms, winlen=1,
...                  dither=5 * pq.ms, min_spikes=6, n_surr=10,
...                  psr_param=[0, 0, 3])['patterns']  
Time for data mining: ...
Time for pvalue spectrum computation: ...
>>> patterns[0] 
{'itemset': (4, 3, 0, 2, 5, 1),
 'windows_ids': (9,
 'neurons': [4, 3, 0, 2, 5, 1],
 'lags': array([0., 0., 0., 0., 0.]) * ms,
 'times': array([  90.,  160.,  550.,  910.,  930., 1420., 1480., 1650., 2570.,
        3130., 3430., 3480., 3610., 3800., 3830., 3930., 4560., 4670.]) * ms,
 'signature': (6, 18),
 'pvalue': 0.0}

Refer to Viziphant documentation to check how to visualzie such patterns.


[Torre, 2013] (1,2,3,4)

Emiliano Torre, David Picado-Muiño, Michael Denker, Christian Borgelt, and Sonja Grün. Statistical evaluation of synchronous spike patterns extracted by frequent item set mining. Frontiers in computational neuroscience, 7:132, 2013.

[Quaglio, 2017] (1,2,3,4)

Pietro Quaglio, Alper Yegenoglu, Emiliano Torre, Dominik M Endres, and Sonja Grün. Detection and evaluation of spatio-temporal spike patterns in massively parallel spike train data with spade. Frontiers in computational neuroscience, 11:41, 2017.

[Stella, 2019] (1,2,3,4)

Alessandra Stella, Pietro Quaglio, Emiliano Torre, and Sonja Grün. 3d-spade: significance evaluation of spatio-temporal patterns of various temporal extents. Biosystems, 185:104022, 2019.