pyhctsa.calculator.FeatureCalculator

class pyhctsa.calculator.FeatureCalculator(config_path=None)

A configuration-driven feature extraction calculator for time series data.

config

The parsed YAML configuration containing feature definitions.

Type:

dict

feature_funcs

A dictionary mapping feature labels to their corresponding callable functions.

Type:

dict

Parameters:
config_path : str or None, optional

Path to the YAML configuration file. If None, uses the default ‘hctsa.yaml’ configuration file in the package configurations directory.

Notes

Besides the operation’s own arguments, each entry of a feature’s configs list may carry these meta keys (not passed to the function):

  • zscore: True: z-score the series first (label gets no suffix; without it, _raw);

  • abs: True: take the absolute value last (suffix _abs);

  • preprocess: one more input transform, applied to the (z-scored) series before abs; its label suffix follows _abs. The values, with the hctsa input each reproduces:

    • decimate_ac1e (suffix _dec): zscore(BF_PreProcess(x_z, 'decimate_ac1e')). The z-scored series is decimated to one sample per floored 1/e autocorrelation time and z-scored again. If that time cannot be determined (e.g. the ACF never falls to 1/e) the feature is NaN. See pyhctsa.utils.decimate_ac1e();

    • diff1 (_diff1): diff(x_z);

    • zscore_abs (_mag): zscore(abs(x_z)); zscore_sign (_sign): zscore(sign(x_z)). (abs: True alone is abs(x_z).)

  • select / exclude: keep or drop keys of a dict-valued output.

Examples

>>> fc = FeatureCalculator()  # Load default configuration
>>> x = np.random.randn(1000)
>>> df = fc.extract(x)
__init__(config_path=None)

Initialises a FeatureCalculator instance.

Parameters:
config_path : str or None, optional

Path to the YAML configuration file. If None, uses the default configuration.

Methods

__init__([config_path])

Initialises a FeatureCalculator instance.

extract(data[, labels, verbose, distributor])

Run the configured feature extractor over one or more time series and return a single tidy pandas.DataFrame.