cerlymarco / shap-hypetune

A python package for simultaneous Hyperparameters Tuning and Features Selection for Gradient Boosting Models.
MIT License
567 stars 71 forks source link

List of the important features? #4

Closed jmrichardson closed 3 years ago

jmrichardson commented 3 years ago

Hi, I apologize if this is a dumb question ,but I can't find where to get the list of important features from the trained model? Thanks for any pointers.

cerlymarco commented 3 years ago

Hi,

Both fitted instances of BoostRFE and BoostBoruta have ranking_and support_attributes:

    ranking_ : ndarray of shape (n_features,)
        The feature ranking, such that ``ranking_[i]`` corresponds to the
        ranking position of the i-th feature (from the best param config 
        when hyperparameters searching). Selected  features are assigned 
        rank 1.

    support_ : ndarray of shape (n_features,)
        The mask of selected features (from the best param config 
        when hyperparameters searching).

Using MyModel.estimator_.feature_importances_ you can access the importances of the selected final model.

VinayChaudhari1996 commented 2 years ago

Hi @cerlymarco ,

1) How do I get feature names with scores like this? (Traditional Xg-Boost) 2) And what will be the X-axis scoring scale for that?

image img-src : https://user-images.githubusercontent.com/42869040/162376574-03869b81-f11e-4d1f-8bea-eddb714d39b0.png

Thanks