pyspi.calculator.Calculator

class pyspi.calculator.Calculator(dataset=None, name=None, labels=None, fast=False, sonnet=False, configfile=None, normalise=True)

Compute all pairwise interactions.

The calculator takes in a multivariate time-series dataset, computes and stores all pairwise interactions for the dataset. It uses a YAML configuration file that can be modified in order to compute a reduced set of pairwise methods.

Example

import numpy as np

dataset = np.random.randn(5,500)   # create a random multivariate time series (MTS)
calc = Calculator(dataset=dataset) # Instantiate the calculator
calc.compute()                     # Compute all pairwise interactions
Parameters
Description

  • labels (array_like, optional) – Any set of strings by which you want to label the calculator. This can be useful later for classification purposes, defaults to None.

  • normalise (bool, optional) - Normalise the dataset along the time axis before computing SPIs, defaults to True.

__init__(dataset=None, name=None, labels=None, subset=None, configfile=None, normalise=True)

Methods

Method
Description

__init__([dataset, name, labels, fast, ...])

compute()

Compute the SPIs on the MVTS dataset.

load_dataset(dataset)

Load a new dataset into existing instance.

set_group(classes)

Assigns a numeric value to a Calculator instance based on a list of classes.

_rmin()

Iterate through all SPIs are remove the minimum. Fixes absolute errors when correlating.

get_stat_labels()

_get_correlation_df(with_labels=False, rmin=False)

Generates a DataFrame showing correlations between SPIs.

Attributes

Attribute
Description

dataset

Dataset as a data object.

group

The numerical group assigned during set_group()

group_name

The group name assigned during set_group().

labels

List of calculator labels.

n_spis

Number of SPIs in the calculator.

name

Name of the calculator.

spis

Dict of SPIs.

table

Results table for all pairwise interactions (each represented as an MPI).

Last updated