Approximation¶
The documentation of the approximation module.
The pyts.approximation
module includes approximation algorithms.
-
class
pyts.approximation.
PAA
(window_size=None, output_size=None, overlapping=True)[source]¶ Piecewise Aggregate Approximation.
Parameters: - window_size : int or None (default = None)
Length of the sliding window.
- output_size : int or None (default = None)
Size of the returned time series.
- overlapping : bool (default = True)
When
output_size
is specified, the window size is fixed ifoverlapping=True
and may vary ifoverlapping=False
. Ignored ifwindow_size
is specified.
Methods
fit
([X, y])Pass. fit_transform
(X[, y])Fit to data, then transform it. get_params
([deep])Get parameters for this estimator. set_params
(**params)Set the parameters of this estimator. transform
(X)Reduce the dimensionality of each time series.
-
class
pyts.approximation.
DFT
(n_coefs=None, anova=False, norm_mean=True, norm_std=True)[source]¶ Discrete Fourier Transform.
Parameters: - n_coefs : None or int (default = None)
The number of Fourier coefficients to keep. If
n_coefs=None
, all Fourier coefficients are returned. Ifn_coefs
is an integer, then_coefs
most significant Fourier coefficients are returned ifanova=True
, otherwise the firstn_coefs
Fourier coefficients are returned. A even number is required (for real and imaginary values) ifanova=False
.- anova : bool (default = False)
If True, the Fourier coefficients selection is done via a one-way ANOVA test. If False, the first Fourier coefficients are selected.
- norm_mean : bool (default = True)
If True, center the data before scaling. If
norm_mean=True
andanova=False
, the first Fourier coefficient will be dropped.- norm_std : bool (default = True)
If True, scale the data to unit variance.
Attributes: - coefs_ : array-like, shape [n_coefs]
Indices of the Fourier coefficients that are kept.
Methods
fit
(X[, y])Fit the model according to the given training data. fit_transform
(X[, y])Fit the model than transform the given training data. get_params
([deep])Get parameters for this estimator. set_params
(**params)Set the parameters of this estimator. transform
(X)Transform the provided data. -
fit
(X, y=None)[source]¶ Fit the model according to the given training data.
Parameters: - X : array-like, shape = [n_samples, n_features]
Training vector, where n_samples in the number of samples and n_features is the number of features.
- y : None or array-like, shape = [n_samples] (default = None)
Class labels for each data sample.
Returns: - self : object
-
fit_transform
(X, y=None)[source]¶ Fit the model than transform the given training data.
Parameters: - X : array-like, shape = [n_samples, n_features]
Training vector, where n_samples in the number of samples and n_features is the number of features.
- y : None or array-like, shape = [n_samples] (default = None)
Class labels for each data sample.
Returns: - X_new : array-like, shape [n_samples, n_coefs]
The selected Fourier coefficients for each sample.