Back to models
Transformer

AutoCorrelationTransformer

Auto-correlation transformer.

Quickstart

python
from sktime.transformations.acf import AutoCorrelationTransformer

estimator = AutoCorrelationTransformer(adjusted=False, n_lags=None, fft=False, missing='none')

Parameters(4)

adjustedbool, default=False
If True, then denominators for autocovariance are n-k, otherwise n.
n_lagsint, default=None
Number of lags to return autocorrelation for. If None, statsmodels acf function uses min(10 * np.log10(nobs), nobs - 1).
fftbool, default=False
If True, computes the ACF via FFT.
missing{“none”, “raise”, “conservative”, “drop”}, default=”none”

How missing values are to be treated in autocorrelation function calculations.

  • “none” performs no checks or handling of missing values

  • “raise” raises an exception if NaN values are found.

  • “drop” removes the missing observations and then estimates the autocovariances treating the non-missing as contiguous.

  • “conservative” computes the autocovariance using nan-ops so that nans are removed when computing the mean and cross-products that are used to estimate the autocovariance. “n” in calculation is set to the number of non-missing observations.

Examples

>>> from sktime.transformations.acf import AutoCorrelationTransformer
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> transformer = AutoCorrelationTransformer (n_lags = 12)
>>> y_hat = transformer. fit_transform (y)