Skip to content

AutoArima predictions hallucinations with only one moving average term (0,0,1)  #587

@BaklazhenkoNikita

Description

@BaklazhenkoNikita

Describe the bug

When using the auto.arima function to model a time series, the algorithm may select a model with only a single moving average term (0,0,1).

For some reason, the first prediction is significantly different from the rest of the predictions, which are constant.

Additionally, changing the time series itself still leads to a situation where the first predicted value differs from the rest.
The fitting process does not raise any errors and seem to converge correctly.
Changing the parameters (seasonality, random state, max p/q/d) still leads to the same issue.

To Reproduce

import pandas as pd
from pmdarima import AutoARIMA

data_values = [
    2864.16, 2864.16, 2864.16, 9601.53, 151964.16, 0.0, 0.0, 0.0, 0.0, 5395.0, 
    941693.6, 470846.8, 0.0, 58572.5, 0.0, -33389.56, 4780.99, 34787.83, 422.76, 
    2591.84, 2283.19, 10168.12, 503.84, 1247.68, 1474.36, 24102.83, 6723.56, 
    8502.49, 2515.96, 719.09, 8909.85, 10958.13, 13680.87, 16403.62, 19126.36, 
    1704.01, 1238.5, 772.99, 307.48, 0.0, 0.0, -163390.34, -81695.17, 0.0, 
    6610.445, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -17948.26, -77011.22, 
    -190568.97, 798722.26, 774135.44, 387067.72, 0.0, 243934.0, -201684.49, 
    -35453.17, 262966.35, 0.0, 0.0, 0.0, -10096.41, 1134534.69
]


y_train = pd.Series(data_values)

arima_params = {
    'start_p': 0,
    'start_q': 0,
    'max_p': 5,
    'max_q': 5,
    'max_d': 2,
    'seasonal': True, 
    'random_state': 314
}
forecaster = AutoARIMA(**arima_params)

forecaster.fit(y_train)

n_periods = 12
y_pred = forecaster.predict(n_periods)

summary = forecaster.summary()
print(summary)
print(y_pred)

Versions

System:
    python: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
executable: c:\Users\_\Programs\Python\Python311\python.exe
   machine: Windows-10-10.0.19045-SP0

Python dependencies:
 setuptools: 65.5.0
        pip: 23.3.1
    sklearn: 1.3.0
statsmodels: 0.14.0
      numpy: 1.25.2
      scipy: 1.11.2
     Cython: 3.0.11
     pandas: 2.1.0
     joblib: 1.3.2
   pmdarima: 2.0.4
Windows-10-10.0.19045-SP0
Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
pmdarima 2.0.4
NumPy 1.25.2
SciPy 1.11.2
Scikit-Learn 1.3.0
Statsmodels 0.14.0

Expected Behavior

The same MA term across entire prediction

Actual Behavior

First prediction is different from all others

Additional Context

Model configurations after the fit:
image
Models forecast:
70 547234.044093
71 53374.305877
72 53374.305877
73 53374.305877
74 53374.305877
75 53374.305877
76 53374.305877
77 53374.305877
78 53374.305877
79 53374.305877
80 53374.305877
81 53374.305877
dtype: float64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions