eli5
eli5 copied to clipboard
KeyError: 'bias' while running show_weights(clf, vec=vec) in xgboost notebook
Could anyone please help me to solve following error,
File "C:\anaconda3\lib\site-packages\xgboost\sklearn.py", line 745, in intercept_ return np.array(json.loads(b.get_dump(dump_format='json')[0])['bias'])
KeyError: 'bias'
KeyError : 'bias' is shown when we run the XGBRegressor, please help us on this error
Seeing the same issue on an XGBClassifier().
I have the same issue as well with XGBClassifier.
I just tested the XgbRegressor and could not reproduce the issue.
Can one of you paste a screenshot of what you is happening?
@SusmithBarigidad @sugarcrm-aorso @danielad-k
Hi @AshwinB-hat I also meet this error.
Python Version Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
I just tested the XgbRegressor and could not reproduce the issue. Can one of you paste a screenshot of what you is happening? @SusmithBarigidad @sugarcrm-aorso @danielad-k
It looks like it may be related to the Classifier while you are referencing the Regressor. Let me know if you need anything more beyond what @supinyu shared.
The bug is not on eli5 but on xgboost. The call hasattre(xgb, 'intercept_')
crashes. This bug is present in the 1.0.2 release and has been fixed by commit Fix checking booster. (#5505). It will be integrated in the 1.1.0 version in preparation (1st release candidate already out).
In the mean time you can easily apply the patch yourself (just one line to change in intercept_(self)
of site-packages/xgboost/sklearn.py). Replace
getattr(self, 'booster', None) is not None and self.booster not in {gbtree', 'dart'}:
by
self.get_params()['booster'] not in {'gbtree', 'dart'}:
.
Thank you very much JulienB-78. I update the xgboost version to 1.1.0rc1. The code will not have this error.
Yup, using the 1.1.0 release candidate worked for me as well. Thanks @JulienB-78