Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: zero-size array to reduction operation maximum which has no identity #15

Open
sn3fru opened this issue Feb 26, 2021 · 0 comments

Comments

@sn3fru
Copy link

sn3fru commented Feb 26, 2021

Error with simple dataset:

ValueError Traceback (most recent call last)
in
1 from causal_impact import CausalImpact
2 ci = CausalImpact(test, 120, n_seasons=7)
----> 3 ci.run(max_iter=1000)
4 ci.plot()

~/anaconda3/envs/python3/lib/python3.6/site-packages/causal_impact/causal_impact.py in run(self, max_iter, return_df)
69 exog=self.data.loc[:self._inter_index - 1, self._reg_cols()].values,
70 level='local linear trend',
---> 71 seasonal=self.n_seasons,
72 )
73 self._fit = self._model.fit(maxiter=max_iter)

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/tsa/statespace/structural.py in init(self, endog, level, trend, seasonal, freq_seasonal, cycle, autoregressive, exog, irregular, stochastic_level, stochastic_trend, stochastic_seasonal, stochastic_freq_seasonal, stochastic_cycle, damped_cycle, cycle_period_bounds, mle_regression, use_exact_diffuse, **kwargs)
571 # Setup the representation
572 super(UnobservedComponents, self).init(
--> 573 endog, k_states, k_posdef=k_posdef, exog=exog, **kwargs
574 )
575 self.setup()

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/tsa/statespace/mlemodel.py in init(self, endog, k_states, exog, dates, freq, **kwargs)
136 super(MLEModel, self).init(endog=endog, exog=exog,
137 dates=dates, freq=freq,
--> 138 missing='none')
139
140 # Store kwargs to recreate model

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/tsa/base/tsa_model.py in init(self, endog, exog, dates, freq, missing, **kwargs)
45 missing='none', **kwargs):
46 super(TimeSeriesModel, self).init(endog, exog, missing=missing,
---> 47 **kwargs)
48
49 # Date handling in indexes

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/model.py in init(self, endog, exog, **kwargs)
234
235 def init(self, endog, exog=None, **kwargs):
--> 236 super(LikelihoodModel, self).init(endog, exog, **kwargs)
237 self.initialize()
238

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/model.py in init(self, endog, exog, **kwargs)
75 hasconst = kwargs.pop('hasconst', None)
76 self.data = self._handle_data(endog, exog, missing, hasconst,
---> 77 **kwargs)
78 self.k_constant = self.data.k_constant
79 self.exog = self.data.exog

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/model.py in _handle_data(self, endog, exog, missing, hasconst, **kwargs)
98
99 def _handle_data(self, endog, exog, missing, hasconst, **kwargs):
--> 100 data = handle_data(endog, exog, missing, hasconst, **kwargs)
101 # kwargs arrays could have changed, easier to just attach here
102 for key in kwargs:

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/data.py in handle_data(endog, exog, missing, hasconst, **kwargs)
670 klass = handle_data_class_factory(endog, exog)
671 return klass(endog, exog=exog, missing=missing, hasconst=hasconst,
--> 672 **kwargs)

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/data.py in init(self, endog, exog, missing, hasconst, **kwargs)
85 self.const_idx = None
86 self.k_constant = 0
---> 87 self._handle_constant(hasconst)
88 self._check_integrity()
89 self._cache = {}

~/anaconda3/envs/python3/lib/python3.6/site-packages/statsmodels/base/data.py in _handle_constant(self, hasconst)
175 (np.ones(self.exog.shape[0]), self.exog))
176 rank_augm = np.linalg.matrix_rank(augmented_exog)
--> 177 rank_orig = np.linalg.matrix_rank(self.exog)
178 self.k_constant = int(rank_orig == rank_augm)
179 self.const_idx = None

<array_function internals> in matrix_rank(*args, **kwargs)

~/anaconda3/envs/python3/lib/python3.6/site-packages/numpy/linalg/linalg.py in matrix_rank(M, tol, hermitian)
1902 S = svd(M, compute_uv=False, hermitian=hermitian)
1903 if tol is None:
-> 1904 tol = S.max(axis=-1, keepdims=True) * max(M.shape[-2:]) * finfo(S.dtype).eps
1905 else:
1906 tol = asarray(tol)[..., newaxis]

~/anaconda3/envs/python3/lib/python3.6/site-packages/numpy/core/_methods.py in _amax(a, axis, out, keepdims, initial, where)
37 def _amax(a, axis=None, out=None, keepdims=False,
38 initial=_NoValue, where=True):
---> 39 return umr_maximum(a, axis, None, out, keepdims, initial, where)
40
41 def _amin(a, axis=None, out=None, keepdims=False,

ValueError: zero-size array to reduction operation maximum which has no identity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant