Skip to content

plot_acf


method plot_acf(columns=None, nlags=None, plot_interval=True, title=None, legend="upper right", figsize=None, filename=None, display=True)[source]
Plot the autocorrelation function.

The autocorrelation function (ACF) measures the correlation between a time series and lagged versions of itself. ACF can help to identify the order of the moving average (MA) process in a time series model. This plot is only available for forecast tasks.

Parameterscolumns: int, str, segment, sequence, dataframe or None, default=None
Columns to plot the acf from. If None, it selects the target column.

nlags: int or None, default=None
Number of lags to return autocorrelation for. If None, it uses min(10 * np.log10(len(y)), len(y) // 2 - 1). The returned value includes lag 0 (i.e., 1), so the size of the vector is (nlags + 1,).

plot_interval: bool, default=True
Whether to plot the 95% confidence interval.

title: str, dict or None, default=None
Title for the plot.

legend: str, dict or None, default="upper right"
Legend for the plot. See the user guide for an extended description of the choices.

  • If None: No legend is shown.
  • If str: Position to display the legend.
  • If dict: Legend configuration.

figsize: tuple or None, default=None
Figure's size in pixels, format as (x, y). If None, it adapts the size to the number of lags shown.

filename: str, Path or None, default=None
Save the plot using this name. Use "auto" for automatic naming. The type of the file depends on the provided name (.html, .png, .pdf, etc...). If filename has no file type, the plot is saved as html. If None, the plot is not saved.

display: bool or None, default=True
Whether to render the plot. If None, it returns the figure.

Returnsgo.Figure or None
Plot object. Only returned if display=None.


See Also

plot_series

Plot a data series.

plot_decomposition

Plot the trend, seasonality and residuals of a time series.

plot_pacf

Plot the partial autocorrelation function.


Example

>>> from atom import ATOMForecaster
>>> from sktime.datasets import load_airline

>>> y = load_airline()

>>> atom = ATOMForecaster(y, random_state=1)
>>> atom.plot_acf()