Skip to content

Rewrite user-guide to clarify feature_importances_ are impurity based #14528

Description

@amueller

We recently added permutation importance, which is a nice alternative to the impurity based feature_importances_ provided by trees.
Whenever we're talking about feature importances in the user guide, we should make sure that we explain that the feature_importances_ attribute refers to impurity based importance.
Where applicable, we should consider replacing its usage by permutation_importance or compare the two.

Activity

  1. added
    Easy
    on Jul 30, 2019
  2. MatthewBosek commented on Jul 31, 2019

    @MatthewBosek

    @amueller Hey! I am new to scikit, open source development, and development in general. Would this be a good issue for me to work on?

  3. shahules786 commented on Jul 31, 2019

    @shahules786

    @amueller I have send a PR,please check.

  4. b1naryher0 commented on Aug 4, 2019

    @b1naryher0

    @amueller Hey! I would also like to work on this issue but I am having trouble starting. I have a basic understanding of scikit-learn. What topics should I read to learn about feature_importances_ ?

  5. hncatanese commented on Oct 24, 2019

    @hncatanese

    I am going to see if I can make progress on this issue.

  6. ogrisel commented on Jan 15, 2020

    @ogrisel
    Member

    I have also added some notes about where to update the doc: #16023 (comment) so as to emphasize that impurity based feature importances can be misleading while permutation-based feature importances are both model agnostic and robust to the cardinality biais.

    Basically we need to cross-reference the two methods and link to the example that compares them.

  7. ogrisel commented on Jan 15, 2020

    @ogrisel
    Member

    Here are some background references and discussion on impurity based feature importances:

    https://stackoverflow.com/a/15821880/163740

  8. reopened this on Feb 4, 2020
  9. ogrisel commented on Feb 4, 2020

    @ogrisel
    Member

    I reopened this because I think we should still consider updating the examples to favor permutation_importance instead or at least compare the two methods each time.

  10. nilichen commented on Mar 19, 2020

    @nilichen
    Contributor

    take

  11. ogrisel commented on Mar 19, 2020

    @ogrisel
    Member

    @nilichen here is the list of examples that mention feature_importances_:

    $ git grep feature_importances_ examples/ | cut -d ":" -f 1 | uniq
    examples/ensemble/plot_forest_importances.py
    examples/ensemble/plot_forest_importances_faces.py
    examples/ensemble/plot_gradient_boosting_regression.py
    examples/inspection/plot_permutation_importance.py
    examples/inspection/plot_permutation_importance_multicollinear.py
    

    The last two examples already compare with permutation_importance: nothing to do.

    The remaining 3 examples would benefit from comparing impurity-based feature importances with the result of permutation_importance when the latter is not to costly (execution lasts less than 30s to compute on a regular laptop).

    In particular if computing permutation_importance in plot_forest_importances_faces.py is too compute intensive, we can keep it that way and just add a link to the user guide. The syntax to add a restructured text reference to the relevant section in the user guide is:

    :ref:`permutation_importance`
    

    Feel free to open a PR for each of them so that we can review and merge them independently of one another.

  12. nilichen commented on Mar 19, 2020

    @nilichen
    Contributor

    Sounds good. That's extremely helpful. Thanks!

  13. azihna commented on Feb 6, 2021

    @azihna
    Contributor

    We are working examples/ensemble/plot_forest_importances.py with @temmyzeus

  14. azihna commented on Feb 9, 2021

    @azihna
    Contributor

    I'll also work on examples/ensemble/plot_forest_importances_faces.py now that the other one is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

DocumentationEasySprint

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions