# giotto.time_series.PermutationEntropy¶

class giotto.time_series.PermutationEntropy(n_jobs=None)

Entropies from sets of permutations arg-sorting rows in arrays.

Given a two-dimensional array A, another array A’ of the same size is computed by arg-sorting each row in A. The permutation entropy [1] of A is the Shannon entropy of the probability distribution given by the relative frequencies of each arg-sorting permutation in A’.

Parameters
n_jobsint or None, optional, default: None

The number of jobs to use for the computation. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.

References

1

C. Bandt and B. Pompe, “Permutation Entropy: A Natural Complexity Measure for Time Series”; Phys. Rev. Lett., 88.17, 2002; doi: 10.1103/physrevlett.88.174102.

Methods

 fit(self, X[, y]) Do nothing and return the estimator unchanged. fit_transform(self, X[, y]) Fit to data, then transform it. get_params(self[, deep]) Get parameters for this estimator. set_params(self, \*\*params) Set the parameters of this estimator. transform(self, X[, y]) Calculate the permutation entropy of each two-dimensional array in X.
__init__(self, n_jobs=None)

Initialize self. See help(type(self)) for accurate signature.

fit(self, X, y=None)

Do nothing and return the estimator unchanged.

This method is there to implement the usual scikit-learn API and hence work in pipelines.

Parameters
Xndarray, shape (n_samples, n_points, n_dimensions)

Input data.

yNone

There is no need for a target in a transformer, yet the pipeline API requires this parameter.

Returns
selfobject
fit_transform(self, X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters
Xnumpy array of shape [n_samples, n_features]

Training set.

ynumpy array of shape [n_samples]

Target values.

Returns
X_newnumpy array of shape [n_samples, n_features_new]

Transformed array.

get_params(self, deep=True)

Get parameters for this estimator.

Parameters
deepboolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns
paramsmapping of string to any

Parameter names mapped to their values.

set_params(self, **params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns
self
transform(self, X, y=None)

Calculate the permutation entropy of each two-dimensional array in X.

Parameters
Xndarray, shape (n_samples, n_points, n_dimensions)

Input data.

yNone

There is no need for a target in a transformer, yet the pipeline API requires this parameter.

Returns
Xtndarray of int, shape (n_samples, 1)

One permutation entropy per entry in X along axis 0.