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

Feature importances are all "nan" with 'permutation' importance, and 'oob_error' = False ---- a very simple demonstration #156

Open
mikez2333 opened this issue Dec 16, 2023 · 0 comments

Comments

@mikez2333
Copy link

mikez2333 commented Dec 16, 2023

I was having this problem, so I made a very simple test case.

(Note: I get importance values with 'permutation' if oob_error is True, and with other importance types in general.)

Ubuntu 22.04 LTS; Python 3.10

from skranger.ensemble import RangerForestClassifier
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier

data = load_iris()
X = data.data
y = data.target
ranger_classifier = RangerForestClassifier(importance = "permutation")
ranger_classifier.fit(X, y)

rf_classifier = RandomForestClassifier()
rf_classifier.fit(X,y)
Debug Window (PyCharm)

ranger_classifier > feature_importances_ = {list: 4} [nan, nan, nan, nan]
                           > importance = {str} 'permutation'
                           > importance_mode_ = {int} 3

rf_classifier > feature_importances_ = {ndarray: (4,)} [0.10225579 0.02359158 0.45525929 0.41889333]
@mikez2333 mikez2333 changed the title Feature importances are all "nan" - a very simple demonstration Feature importances are all "nan" with 'permutation' importance, and 'oob_error' = False - a very simple demonstration Dec 16, 2023
@mikez2333 mikez2333 changed the title Feature importances are all "nan" with 'permutation' importance, and 'oob_error' = False - a very simple demonstration Feature importances are all "nan" with 'permutation' importance, and 'oob_error' = False ---- a very simple demonstration Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant