Closed ahardjasa closed 5 years ago
I'll take a look when I get a chance. PRs are always welcome.
This should be handled now in v0.8.1. I've even got a test for this exact case (pyramid/arima/tests/test_arima:test_issue_30)
:
def test_issue_30():
# From the issue:
vec = np.array([33., 44., 58., 49., 46., 98., 97.])
auto_arima(vec, out_of_sample_size=1, seasonal=False,
suppress_warnings=True)
# This is a way to force it:
ARIMA(order=(0, 1, 0), out_of_sample_size=1).fit(vec)
# Want to make sure it works with exog arrays as well
exog = np.random.RandomState(1).rand(vec.shape[0], 2)
auto_arima(vec, exogenous=exog, out_of_sample_size=1,
seasonal=False,
suppress_warnings=True)
# This is a way to force it:
ARIMA(order=(0, 1, 0), out_of_sample_size=1).fit(vec, exogenous=exog)
Tying statsmodels' ARMA
, ARIMA
and SARIMAX
together under the hood of pyramid's ARIMA
is tricky and that's why we have had several bumps like this. Thanks for being patient, and as always keep reporting issues as you find them 😄
Description
ValueError: operands could not be broadcast together with shapes
raised when performing CV.I think this is due to this line, which happens after prediction of the held-out samples. Adding one to the length of the created exog array (i.e.
model_res.model.exog = np.ones((y.shape[0]+1, 1))
) seems to fix it but I'm not sure that would be the real fix.Steps/Code to Reproduce
Versions
Linux-4.15.0-30-generic-x86_64-with-debian-buster-sid Python 3.5.5 (default, Jul 24 2018, 13:20:46) [GCC 7.3.0] Pyramid 0.7.1 NumPy 1.15.0 SciPy 1.1.0 Scikit-Learn 0.19.2 Statsmodels 0.9.0