阿里玛型号.fit诱导值

2024-04-19 21:24:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试生成一个ARIMA模型,用于预测集群的使用情况。我用的是statsmodel.tsa.arima\ U模型尤其是图书馆。你知道吗

下面是我正在使用的数据:https://imgur.com/s4CS1AU

以下是数据的条形图:https://imgur.com/a/wUyleFC

import pandas as pd
import numpy as np
from statsmodels.tsa.arima_model import ARIMA

X = series.values
size = int(len(X) * 0.66)
train, test = X[0:size], X[size:len(X)]
history = [x for x in train]
predictions = list()
for t in range(len(test)):
    model = ARIMA(history, order=(7,1,1))
    model_fit = model.fit(disp=0)
    output = model_fit.forecast()
    yhat = output[0]
    predictions.append(yhat)
    obs = test[t]
    history.append(obs)
    print('predicted=%f, expected=%f' % (yhat, obs))
error = mean_absolute_percentage_error(test, predictions)
print('Test MAPE: %.3f' % error)

对于ARIMA对象阶的(p,d,q)值的某些值,阿里玛·菲特()产生ValueError。以下是我遇到的几个错误示例:

顺序(6,1,1)

ValueError: The computed initial AR coefficients are not stationary
You should induce stationarity, choose a different model order, or you can
pass your own start_params.

顺序(0,1,7)/顺序(1,1,2)/顺序(6,0,7)

ValueError: The computed initial MA coefficients are not invertible
You should induce invertibility, choose a different model order, or you 
can pass your own start_params.

顺序(4,1,4)

LinAlgError: SVD did not converge

对于几乎所有的p,d,q值,即使改变d参数并保持p和q不变,这些误差中至少有一个会发生。你知道吗

如何避免这些错误?任何帮助都将不胜感激!你知道吗


Tags: testimportsizemodellen顺序ordererror