【发布时间】:2018-10-25 14:05:50
【问题描述】:
我安装了 Anaconda 5.3.0 Winx86。我使用conda install -c anaconda py-xgboost 安装了 xgboost 包
在 Jupyter Notebook 中,我可以导入 XGBRegressorfrom xgboost import XGBRegressor
但是当我使用xgb = XGBRegressor() 时。我收到以下错误:
XGBoostError Traceback (most recent call last)
<ipython-input-2-99b3db9fba2c> in <module>
----> 1 xgb = XGBRegressor()
C:\ProgramData\Anaconda3\lib\site-packages\xgboost\sklearn.py in __init__(self, max_depth, learning_rate, n_estimators, silent,objective,nthread, gamma, min_child_weight, max_delta_step, subsample, colsample_bytree, colsample_bylevel, reg_alpha, reg_lambda, scale_pos_weight, base_score, seed, missing)
119 base_score=0.5, seed=0, missing=None):
120 if not SKLEARN_INSTALLED:
--> 121 raise XGBoostError('sklearn needs to be installed in order to use this module')
122 self.max_depth = max_depth
123 self.learning_rate = learning_rate
XGBoostError: sklearn needs to be installed in order to use this module
但我可以导入 sklearn 模块而不会出现任何错误:
import sklearn。我尝试重新安装 anaconda 和 xgboost 但没有任何效果。
【问题讨论】:
标签: python scikit-learn anaconda xgboost