PermutationEntropy¶
-
class
gtda.time_series.
PermutationEntropy
(n_jobs=None)[source]¶ 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_jobs (int or None, optional, default:
None
) – The number of jobs to use for the computation.None
means 1 unless in ajoblib.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.
-
fit
(X, y=None)[source]¶ Do nothing and return the estimator unchanged.
This method is here to implement the usual scikit-learn API and hence work in pipelines.
- Parameters
X (ndarray of shape (n_samples, n_points, n_dimensions)) – Input data.
y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.
- Returns
self
- Return type
object
-
fit_transform
(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
X (ndarray of shape (n_samples, n_points, n_dimensions)) – Input data.
y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.
- Returns
Xt – One permutation entropy per entry in X along axis 0.
- Return type
ndarray of int, shape (n_samples, 1)
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
set_params
(**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.- Parameters
**params (dict) – Estimator parameters.
- Returns
self – Estimator instance.
- Return type
object
-
transform
(X, y=None)[source]¶ Calculate the permutation entropy of each two-dimensional array in X.
- Parameters
X (ndarray of shape (n_samples, n_points, n_dimensions)) – Input data.
y (None) – There is no need for a target in a transformer, yet the pipeline API requires this parameter.
- Returns
Xt – One permutation entropy per entry in X along axis 0.
- Return type
ndarray of int, shape (n_samples, 1)