尝试在JupyterLab上的Python中进行ARIMA预测时,我遇到了一个奇怪的错误LinAlgError: SVD did not converge
。
我浏览了此问题,提到的常见原因是数组中存在NaN或无效值。奇怪的是,在以下两个列表中-ARIMA模型适用于第一个列表(即RegistrationRates1
)而不适用于第二个列表(即RegistrationRates
),但两个列表的结构相同。
==========RegistrationRates1==========
20
[[43.80517448], [39.36453258], [39.70608009], [39.39300158], [43.30890468], [45.21370359], [46.72624559], [46.2387957], [46.67145853], [49.18804367], [47.71981447], [51.36193024], [52.8201166], [51.22670829], [53.56771018], [50.00680673], [52.39296528], [53.20835592], [50.80719854], [52.54866463]]
[<class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>]
==========RegistrationRates==========
20
[[36.30621294], [29.44909876], [26.76993013], [28.15856476], [32.70576672], [32.21908981], [36.840430700000006], [32.28168264], [30.70488457], [34.27677665], [27.53115582], [30.920245399999995], [30.61829196], [26.56064405], [29.51944325], [26.6194901], [24.05321567], [33.384220500000005], [23.63554653], [20.63679245]]
[<class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>, <class 'list'>]
我已经打印了列表名称,大小,内容和列表元素的类型。一切看起来都很相似,因此我找不到此错误的可能原因:
..\lib\site-packages\statsmodels\base\model.py:492: HessianInversionWarning: Inverting hessian failed, no bse or cov_params available
'available', HessianInversionWarning)
..\lib\site-packages\statsmodels\base\model.py:512: ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals
"Check mle_retvals", ConvergenceWarning)
---------------------------------------------------------------------------
LinAlgError Traceback (most recent call last)
<ipython-input-42-f1cab0f554ce> in <module>
60 predictions = list()
61 for i in range (10):
---> 62 predicted= StartARIMAForecasting(RegistrationRates, 5,1,0)
63 p = predicted[0]
64 predictions.append(p)
<ipython-input-42-f1cab0f554ce> in StartARIMAForecasting(Actual, P, D, Q)
13 def StartARIMAForecasting(Actual, P, D, Q):
14 model = ARIMA(Actual, order=(P, D, Q))
---> 15 model_fit = model.fit(disp=0)
16 prediction = model_fit.forecast()[0]
17 return prediction
LONG LONG STACK-TRACE and then
LinAlgError: SVD did not converge