2

I have the following snippet of code:

import pmdarima as pmd

ts = [-3, 86, 5, 52, 68, 14, 20, 12, 22, -4, -2]
model = pmd.auto_arima(ts, start_p=1, start_q=1, test="adf")
est = model.predict(1)[0]

It fails on the last line with stack trace:

Traceback (most recent call last):
  File "/Users/josh/Code/nfl-scraper/score.py", line 117, in <module>
    do_arima(info, data)
  File "/Users/josh/Code/nfl-scraper/score.py", line 98, in do_arima
    est = model.predict(1)[0]
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pmdarima/arima/arima.py", line 676, in predict
    f, conf_int = _seasonal_prediction_with_confidence(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pmdarima/arima/arima.py", line 88, in _seasonal_prediction_with_confidence
    check_array(conf_int, copy=False, dtype=None)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
    return f(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/utils/validation.py", line 720, in check_array
    _assert_all_finite(array,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/utils/validation.py", line 103, in _assert_all_finite
    raise ValueError(
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

As there is no NaN or infinite values in ts, and I'm not sure what this auto_arima function is returning or why it is returning something with NaN/inf in it, I'm unsure how to debug this. Any help would be appreciated.

Some things I found out:

  • a NaN is causing the issue – I printed out the value of the thing that raised this error
  • When I have the auto_arima function print what its doing (by setting kwarg trace=True), it looks like it is working:
Performing stepwise search to minimize aic
 ARIMA(1,2,1)(0,0,0)[0]             : AIC=inf, Time=0.04 sec
 ARIMA(0,2,0)(0,0,0)[0]             : AIC=106.377, Time=0.01 sec
 ARIMA(1,2,0)(0,0,0)[0]             : AIC=102.327, Time=0.01 sec
 ARIMA(0,2,1)(0,0,0)[0]             : AIC=inf, Time=0.02 sec
 ARIMA(2,2,0)(0,0,0)[0]             : AIC=98.349, Time=0.03 sec
 ARIMA(3,2,0)(0,0,0)[0]             : AIC=99.145, Time=0.03 sec
 ARIMA(2,2,1)(0,0,0)[0]             : AIC=98.258, Time=0.03 sec
 ARIMA(3,2,1)(0,0,0)[0]             : AIC=100.256, Time=0.04 sec
 ARIMA(2,2,2)(0,0,0)[0]             : AIC=inf, Time=0.15 sec
 ARIMA(1,2,2)(0,0,0)[0]             : AIC=inf, Time=0.10 sec
 ARIMA(3,2,2)(0,0,0)[0]             : AIC=12.000, Time=0.05 sec
 ARIMA(3,2,3)(0,0,0)[0]             : AIC=inf, Time=0.17 sec
 ARIMA(2,2,3)(0,0,0)[0]             : AIC=inf, Time=0.19 sec
 ARIMA(3,2,2)(0,0,0)[0] intercept   : AIC=14.000, Time=0.07 sec

Best model:  ARIMA(3,2,2)(0,0,0)[0]          
Total fit time: 0.952 seconds
Josh K
  • 79
  • 1
  • 12
  • 1
    looks to be an [known issue](https://github.com/alkaline-ml/pmdarima/issues/404). Doesn't seem like there's been a fix – chitown88 Aug 30 '21 at 07:36

0 Answers0