elephant.spade.concepts_mining

elephant.spade.concepts_mining(spiketrains, bin_size, winlen, min_spikes=2, min_occ=2, max_spikes=None, max_occ=None, min_neu=1, report='a')[source]

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. Hence, the output are all the repeated sequences of spikes with maximal length winlen, which are not trivially explained by the same number of occurrences of a superset of spikes.

Parameters:
spiketrainslist of neo.core.SpikeTrain or
elephant.conversion.BinnedSpikeTrain

Either list of the spiketrains to analyze or BinningSpikeTrain object containing the binned spiketrains to analyze

bin_sizepq.Quantity

The time precision used to discretize the spiketrains (clipping).

winlenint

The size (number of bins) of the sliding window used for the analysis. The maximal length of a pattern (delay between first and last spike) is then given by winlen*bin_size

min_spikesint, optional

Minimum number of spikes of a sequence to be considered a pattern. Default: 2

min_occint, optional

Minimum number of occurrences of a sequence to be considered as a pattern. Default: 2

max_spikesint, optional

Maximum number of spikes of a sequence to be considered a pattern. If None no maximal number of spikes is considered. Default: None

max_occint, optional

Maximum number of occurrences of a sequence to be considered as a pattern. If None, no maximal number of occurrences is considered. Default: None

min_neuint, optional

Minimum number of neurons in a sequence to be considered a pattern. Default: 1

report{‘a’, ‘#’, ‘3d#’}, optional

Indicates the output of the function.

‘a’:

All the mined patterns

‘#’:

Pattern spectrum using as signature the pair: (number of spikes, number of occurrence)

‘3d#’:

Pattern spectrum using as signature the triplets: (number of spikes, number of occurrence, difference between the times of the last and the first spike of the pattern)

Default: ‘a’

Returns:
mining_resultsnumpy.ndarray
If report == ‘a’:

Numpy array of all the pattern candidates (concepts) found in the spiketrains. Each pattern is represented as a tuple containing (spike IDs, discrete times (window position) of the occurrences of the pattern). The spike IDs are defined as: spike_id=neuron_id*bin_id with neuron_id in [0, len(spiketrains)] and bin_id in [0, winlen].

If report == ‘#’:

The pattern spectrum is represented as a numpy array of triplets (pattern size, number of occurrences, number of patterns).

If report == ‘3d#’:

The pattern spectrum is represented as a numpy array of quadruplets (pattern size, number of occurrences, difference between last and first spike of the pattern, number of patterns)

rel_matrixscipy.sparse.coo_matrix

A binary matrix of shape (number of windows, winlen*len(spiketrains)). Each row corresponds to a window (order according to their position in time). Each column corresponds to one bin and one neuron, and it is 0 if no spikes or 1 if one or more spikes occurred in that bin for that particular neuron. For example, the entry [0,0] of this matrix corresponds to the first bin of the first window position for the first neuron, the entry [0,winlen] to the first bin of the first window position for the second neuron.