elephant.spade.pattern_set_reduction(concepts, ns_signatures, winlen, spectrum, h_subset_filtering=0, k_superset_filtering=0, l_covered_spikes=0, min_spikes=2, min_occ=2)[source]

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

PSR determines which patterns in concepts_psf are statistically significant given any other pattern, on the basis of the pattern size and occurrence count (“support”). Only significant patterns are retained. The significance of a pattern A is evaluated through its signature (z_a, c_A), where z_A = |A| is the size and c_A - the support of A, by either of:

  • subset filtering: any pattern B is discarded if concepts contains a superset A of B such that (z_B, c_B - c_A + h) \in \text{ns}_{\text{signatures}}
  • superset filtering: any pattern A is discarded if concepts contains a subset B of A such that (z_A - z_B + k, c_A) \in \text{ns}_{\text{signatures}}
  • covered-spikes criterion: for any two patterns A, B with A \subset B, B is discarded if (z_B-l) \cdot c_B \le c_A \cdot (z_A - l), A is discarded otherwise;
  • combined filtering: combines the three procedures above: takes a list concepts (see output psf function) and performs combined filtering based on the signature (z, c) of each pattern, where z is the pattern size and c the pattern support.

For any two patterns A and B in concepts_psf such that B \subset A, check:

  1. (z_B, c_B - c_A + h) \in \text{ns}_{\text{signatures}}, and
  2. (z_A - z_B + k, c_A) \in \text{ns}_{\text{signatures}}.


  • if 1) and not 2): discard B
  • if 2) and not 1): discard A
  • if 1) and 2): discard B if
    c_B \cdot (z_B - l) \le c_A \cdot (z_A - l), otherwise discard A
  • if neither 1) nor 2): keep both patterns


  • a pair of concepts cannot cause one another to be rejected
  • if two concepts overlap more than min_occ times, one of them can account for all occurrences of the other one if it passes the filtering

List of concepts, each consisting in its intent and extent


A list of non-significant pattern signatures (z, c)


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.

spectrum{‘#’, ‘3d#’}

Define the signature of the patterns.

‘#’: pattern spectrum using the as signature the pair:

(number of spikes, number of occurrences)

‘3d#’: pattern spectrum using the as signature the triplets:

(number of spikes, number of occurrence, difference between last and first spike of the pattern)

h_subset_filteringint, optional

Correction parameter for subset filtering Default: 0

k_superset_filteringint, optional

Correction parameter for superset filtering Default: 0

l_covered_spikesint, optional

Correction parameter for covered-spikes criterion Default: 0

min_spikesint, optional

Minimum pattern size Default: 2

min_occint, optional

Minimum number of pattern occurrences Default: 2


A tuple containing the elements of the input argument that are significant according to combined filtering.