user5768866
user5768866

Reputation:

AttributeError: 'module' object has no attribute 'XGBClassifier' on anaconda

I am using python 3.6.2 on Anaconda in ubuntu, and installed xgboost by using pip install xgboost and also the method from here (set pythonpath to the library), but both will not work, always show

'module' object has no attribute 'XGBClassifier'

Below is my code:

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) 

Upvotes: 1

Views: 3501

Answers (1)

user5768866
user5768866

Reputation:

I already solved this issue by using conda install -c conda-forge xgboost=0.6a2

Upvotes: 3

Related Questions