For bugs or installation issues, please provide the following information.
The more information you provide, the more easily we will be able to offer
help and advice.
Operating System:
amazonlinux:latest container which is Red Hat 4.8.3-9
Compiler:
gcc/gcc-c++
Package used (python/R/jvm/C++):
python
xgboost
version used:
tags/v0.60
If installing from source, please provide
git rev-parse HEAD
)If you are using jvm package, please
If you are using python package, please provide
The python version and distribution
Python 3.6.2
joblib==0.11
numpy==1.13.1
scipy==0.19.1
scikit-learn==0.19.0
The command to install xgboost
if you are not installing from source
If you are using R package, please provide
sessionInfo()
xgboost
if you are not installing from sourceIt looks like when you load a XGBClassifier model that was trained and persisted in another python process when calling any method that internally calls booster() a TypeError: 'str' object is not callable is raised. What's weird is that the only thing booster() is doing is checking if self._Booster is None. So, I think something in the chain of scikit-learn, xgboost and joblib.load() is redefining booster() as a string. I was able to work around this by updating all calls to booster() in sklearn.py to self._Booster.
Is there any workaround?
Sorry, I should have been more clear in my write up above. We ended up adding the following command to our docker file. It's ugly but it works on the tags/v0.60 tag.
sed -i -e 's/booster()/_Booster/g' python-package/xgboost/sklearn.py
We have the same problem too
@Diyago Its apparent from the @Zambonilli's comment that *.booster() should be replaced by *._Booster and without brackets. they have added booster as a parameter to the xgboost sklearn family and its a string, thus not callable.
Hope this helps :)
怎么解决?
How to solve this problem
windows7 python3.6.1 sklearn0.19 xgboost0.7
@wuleiyuan Check my last comment and make the necessary changes in your code. It worked for me! I hope it works for u :)
Upgrading to xgboost0.7 helped solve the problem for me. The problem occurred on Ubuntu 16.04 w/xgboost0.6.
Sometimes using get_booster() instead of booster() just solved the problem.
使用get_booster()就可以解决
使用get_booster()就可以解决
Most helpful comment
@Diyago Its apparent from the @Zambonilli's comment that *.booster() should be replaced by *._Booster and without brackets. they have added booster as a parameter to the xgboost sklearn family and its a string, thus not callable.
Hope this helps :)