ImportError : cannot import name "XGBClassifier"

Viewed 19938

I am under anaconda notebook.

I have recently installed xgboost but I cannot access XGBClassifier :

from xgboost import XGBClassifier

When I import only xgboost and write xgboost it prints that the module is here ..

3 Answers

Mine works after renaming the py file I was working on. I my case, from 'xgboost' to something else.

P.S. Restarting anaconda/spyder didn't work for me

use this instead : -

import xgboost as xgb
xgb_regressor = xgb.XGBRegressor()

This worked for me.......

Related