I'm getting ValueError: zero-size array to reduction operation maximum which has no identity from nsdiffs with default test but not from OCSBTest().estimate_seasonal_differencing_term.
nsdiffs with ch test is also running fine.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [31], line 1
----> 1 nsdiffs(y, m=12)
File ~/lib/python3.8/site-packages/pmdarima/arima/utils.py:123, in nsdiffs(x, m, max_D, test, **kwargs)
117 warnings.warn("Appropriate D value may not have been reached; "
118 "length of seasonally-differenced array (%i) is "
119 "shorter than m (%i). Using D=%i"
120 % (len(x), m, D))
121 return D
--> 123 dodiff = testfunc(x)
125 return D
File ~lib/python3.8/site-packages/pmdarima/arima/seasonality.py:597, in OCSBTest.estimate_seasonal_differencing_term(self, x)
594 x = check_endog(x, dtype=DTYPE, preserve_series=False)
596 # Get the critical value for m
--> 597 stat = self._compute_test_statistic(x)
598 crit_val = self._calc_ocsb_crit_val(self.m)
599 return int(stat > crit_val)
File ~lib/python3.8/site-packages/pmdarima/arima/seasonality.py:537, in OCSBTest._compute_test_statistic(self, x)
535 for lag_term in range(1, maxlag + 1): # 1 -> maxlag (incl)
536 try:
--> 537 fit = self._fit_ocsb(x, m, lag_term, maxlag)
...
280 umr_minimum(a, axis, None, None, keepdims),
281 out
282 )
ValueError: zero-size array to reduction operation maximum which has no identity
To Reproduce
from pmdarima.arima.utils import nsdiffs
import numpy as np
y = np.array([110000., 110000., 74000., 60500., 60500., 49500., 60500.,
60500., 90500., 74000., 74000., 90500., 90500., 74000.,
74000., 49500., 49500., 40500., 49500., 49500., 74000.,
60500., 90500., 90500., 90500., 90500.])
nsdiffs(y, m=12)
# ValueError: zero-size array to reduction operation maximum which has no identity
from pmdarima.arima.seasonality import OCSBTest
OCSBTest(m=12).estimate_seasonal_differencing_term(y)
# 1
Describe the bug
I'm getting
ValueError: zero-size array to reduction operation maximum which has no identity
fromnsdiffs
with default test but not fromOCSBTest().estimate_seasonal_differencing_term
.nsdiffs
withch
test is also running fine.To Reproduce
Versions
Expected Behavior
No Value Error
Actual Behavior
Raise Value Error
Additional Context
No response