Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XGBRegressor Importance_type #4094

Closed
GustavoGL opened this issue Jan 31, 2019 · 3 comments
Closed

XGBRegressor Importance_type #4094

GustavoGL opened this issue Jan 31, 2019 · 3 comments

Comments

@GustavoGL
Copy link

Thanks for participating in the XGBoost community! We use https://discuss.xgboost.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first :)

Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed.

For bug reports, to help the developer act on the issues, please include a description of your environment, preferably a minimum script to reproduce the problem.

For feature proposals, list clear, small actionable items so we can track the progress of the change.

@GustavoGL
Copy link
Author

I am creating a model with XGBRegressor and I noticed that the attribute importance_type, which is set to "gain" by default always uses type "weight", no matter the specified value.
This attribute sets the feature importance type for the feature_importances_ property.

To reproduce the issue, try creating two XGBRegressor models with the same parameters using different values for the importance_type attribute. Then, call the property feature_importances_ and the result obtained is the same.

I have checked in the definition of this property and it seems to be using the get_fscore() method of the XGBModel.getbooster() tree model. This function always uses importance_type="weight", hard-coded.

I am using XGBoost version 0.81 installed with conda.
Python: 3.6
Operating system: MacOS Mojave version 10.14.2

@GustavoGL GustavoGL reopened this Jan 31, 2019
@hcho3
Copy link
Collaborator

hcho3 commented Jan 31, 2019

The fix was made in #3876, and it is not part of version 0.81. Can you compile from the source?

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
mkdir build
cd build
CC=gcc-8 CXX=g++-8 cmake ..
make -j4
cd ../python-package
python setup.py install

@GustavoGL
Copy link
Author

Ok. Thanks!
I am closing the issue then.

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants