speedml icon indicating copy to clipboard operation
speedml copied to clipboard

Titanic tutorial with speedml error in plot.py

Open ghost opened this issue 8 years ago • 3 comments

I'm just following the tutorial on your github page. When I hit sml.plot.xgb_importance() method, I get below error

python3.6\lib\site-packages\speedml\plot.py in xgb_importance(self) 145 X = X.drop([Base.target], axis=1) 146 self._create_feature_map(X.columns) --> 147 fscore = Base.xgb_model.booster.get_fscore(fmap=Base._config['outpath'] + 'xgb.fmap') 148 self._plot_importance(list(fscore.keys()), list(fscore.values()))

AttributeError: 'str' object has no attribute 'get_fscore'

pdb Base.xgb_model below

XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1, colsample_bytree=0.8, gamma=0, learning_rate=0.1, max_delta_step=0, max_depth=3, min_child_weight=1, missing=None, n_estimators=17, nthread=-1, objective='binary:logistic', reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=0, silent=True, subsample=0.8)

booster is a string and not xgboost module

It is not clear how to resolve the issue. Python version 3.6, speedml version 0.9, xgboost version 0.6, running on Windows 10 with Jupyter notebook

ghost avatar Nov 03 '17 02:11 ghost

LOL I just sent a pull request (https://github.com/Speedml/speedml/pull/27) to fix this exact issue.

stewart123579 avatar Nov 30 '17 03:11 stewart123579

I tried a few local code changes to fix the error but it just went down a rabbit hole and would fail further down a level. Windows seems to not support xgboost module

I switched to Unix environment and was able to get it working. I use digital ocean droplet to run this and use SSH tunnel to access jupyter on my browser.

ghost avatar Nov 30 '17 14:11 ghost

I'll try your fix when the PR is merged. I'm curious to see the fix 😊

ghost avatar Nov 30 '17 15:11 ghost