1
我在ubuntu上使用python 3.6.2上的Anaconda,并使用“pip install xgboost”安装xgboost,也从here(将pythonpath设置为库),但两者不能工作,总是显示 “AttributeError:'module'对象在anaconda上没有属性'XGBClassifier'
'module' object has no attribute 'XGBClassifier'
”
下面是我的代码:
cv_params = {'max_depth': [3,5,7], 'min_child_weight': [1,3,5]}
ind_params = {'learning_rate': 0.1, 'n_estimators': 1000, 'seed':0, 'subsample': 0.8, 'colsample_bytree': 0.8,
'objective': 'binary:logistic'}
optimized_GBM = GridSearchCV(xgb.XGBClassifier(**ind_params),
cv_params,
scoring = 'accuracy', cv = 5, n_jobs = -1)
This works。修复后不要忘记重新启动内核。 – Nib