使用appelpy库时获取分类exog contains inf or nan
,appelpy库基本上封装了statsmodels库。
当我检查数据帧的max、min和nan计数时,得到16.515144564913754, -17.483752761281725, 0
。你知道吗
有什么问题吗?你知道吗
--> 587 self.train_transformed_data.columns.values,
588 ).fit()
589 return ols
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/appelpy/linear_model.py in fit(self, printing)
637 self._model_selection_stats = model_selection_dict
638
--> 639 self._standardize_results()
640
641 self._is_fitted = True
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/appelpy/linear_model.py in _standardize_results(self)
663 # Model fitting
664 model_standardized = sm.OLS(self._y_standardized,
--> 665 sm.add_constant(self._X_standardized))
666 results_obj = model_standardized.fit(cov_type=self._cov_type)
667 self._resid_standardized = pd.Series((self._results.get_influence()
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/regression/linear_model.py in __init__(self, endog, exog, missing, hasconst, **kwargs)
836 **kwargs):
837 super(OLS, self).__init__(endog, exog, missing=missing,
--> 838 hasconst=hasconst, **kwargs)
839 if "weights" in self._init_keys:
840 self._init_keys.remove("weights")
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/regression/linear_model.py in __init__(self, endog, exog, weights, missing, hasconst, **kwargs)
682 weights = weights.squeeze()
683 super(WLS, self).__init__(endog, exog, missing=missing,
--> 684 weights=weights, hasconst=hasconst, **kwargs)
685 nobs = self.exog.shape[0]
686 weights = self.weights
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/regression/linear_model.py in __init__(self, endog, exog, **kwargs)
194 """
195 def __init__(self, endog, exog, **kwargs):
--> 196 super(RegressionModel, self).__init__(endog, exog, **kwargs)
197 self._data_attr.extend(['pinv_wexog', 'wendog', 'wexog', 'weights'])
198
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/model.py in __init__(self, endog, exog, **kwargs)
214
215 def __init__(self, endog, exog=None, **kwargs):
--> 216 super(LikelihoodModel, self).__init__(endog, exog, **kwargs)
217 self.initialize()
218
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/model.py in __init__(self, endog, exog, **kwargs)
66 hasconst = kwargs.pop('hasconst', None)
67 self.data = self._handle_data(endog, exog, missing, hasconst,
---> 68 **kwargs)
69 self.k_constant = self.data.k_constant
70 self.exog = self.data.exog
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/model.py in _handle_data(self, endog, exog, missing, hasconst, **kwargs)
89
90 def _handle_data(self, endog, exog, missing, hasconst, **kwargs):
---> 91 data = handle_data(endog, exog, missing, hasconst, **kwargs)
92 # kwargs arrays could have changed, easier to just attach here
93 for key in kwargs:
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/data.py in handle_data(endog, exog, missing, hasconst, **kwargs)
633 klass = handle_data_class_factory(endog, exog)
634 return klass(endog, exog=exog, missing=missing, hasconst=hasconst,
--> 635 **kwargs)
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/data.py in __init__(self, endog, exog, missing, hasconst, **kwargs)
78 self.const_idx = None
79 self.k_constant = 0
---> 80 self._handle_constant(hasconst)
81 self._check_integrity()
82 self._cache = {}
~/.local/share/virtualenvs/crawto-LwgXxa6A/lib/python3.6/site-packages/statsmodels/base/data.py in _handle_constant(self, hasconst)
124 ptp_ = np.ptp(self.exog, axis=0)
125 if not np.isfinite(ptp_).all():
--> 126 raise MissingDataError('exog contains inf or nans')
127 const_idx = np.where(ptp_ == 0)[0].squeeze()
128 self.k_constant = const_idx.size
MissingDataError: exog contains inf or nans```
目前没有回答
相关问题 更多 >
编程相关推荐