Skip to content

[MRG] FEA Lift metric and curve #21320

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

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

nawarhalabi
Copy link

Reference Issues/PRs

implements partially what is in two stale PRs in a significantly more complete manner:

What does this implement/fix? Explain your changes.

Implemented the lift_score metric function, with the lift_curve function and the LiftCurveDisplay class.

Lift is a commonly used metric in evaluating response to ad campaigns. please read:

This implementation includes:

  • implementation of lift_score in sklearn/metrics/_classification.py for calculating a single value
  • Implementation of lift_curve in sklearn/metrics/_ranking.py for calculating an array of lifts based on different positive classification rates
  • Implementation of LiftCurveDisplay in sklearn/metrics/_plot/lift_curve.py for plotting the lift curve/chart
  • Added documentation in the model_evaluation section for lift and referenced the function page which contains examples

@nawarhalabi nawarhalabi changed the title [MRG] Lift metric and curve [MRG] FEA Lift metric and curve Oct 13, 2021
@nawarhalabi
Copy link
Author

nawarhalabi commented Nov 11, 2021

Any recommendations/comments. The lift metric seems to be a desired feature in previous PRs.
@jnothman, @rth, @GuillemGSubies I am ating you as you had a look at the previous PRs related #18479 and #10003
Thanks!

@jnothman
Copy link
Member

Thanks @nawarhalabi this looks quite nice. However, given that the major bottleneck in scikit-learn is in review time, I'd suggest you break it into smaller contributions, starting with the lift_curve function and its tests. For lift_score I'd be interested in seeing references to its use in practice for classification evaluation or diagnostics.

@nawarhalabi
Copy link
Author

nawarhalabi commented Nov 24, 2021

Thanks @jnothman

@jnothman
Copy link
Member

jnothman commented Nov 24, 2021 via email

@lorentzenchr
Copy link
Member

Just to clarify expectations: While splitting this PR will help in the review process, it is not yet decided to include the proposed functionality. In #21718, we are trying to figure out some principles for model evaluation tools.

@adrinjalali
Copy link
Member

@lorentzenchr do you think these days we'd be including this in the codebase?

Or is this something we'd be happier to have in skrub @GaelVaroquaux @ogrisel

or maybe scikit-lego? (@koaning)

@koaning
Copy link

koaning commented Mar 7, 2024

I'd be open to adding it to scikit-lego. But at first glance it does feel general enough that it could also live here. If the conclusion is that it's not a great fit for sklearn or skrub then I'll gladly consider it for sklego.

@lorentzenchr
Copy link
Member

I think an "ML Gini index" as well as an accompanying graph "Cumulative Accuracy Profile" (CAP)1 for non-negative regression (of which binary classification is an example) would complete our tools for measuring ranking (discriminative) power of models and generalize the existing AUC and ROC.

Note that there is a great confusion about terms. In Gini Index and Friends, my coauthors and me summarized existing literature and gave tutorial like examples. This is now my main reference if I look up terms like "Gini index" (which one?!?!?).

1 aka gain curve and (cumulative) lift curve, it is almost the inverted Lorenz curve of the empirical distribution generated by the model predictions.

@lorentzenchr lorentzenchr removed the Needs Decision Requires decision label Mar 7, 2024
@adrinjalali
Copy link
Member

@nawarhalabi would you be able to give this PR an update?

@glemaitre
Copy link
Member

For sure we should prioritize this action when it comes to the inspection.

@lorentzenchr
Copy link
Member

For sure we should prioritize this action when it comes to the inspection.

What do you mean by action?

@glemaitre
Copy link
Member

Wrong word, my brain did not work properly. By "action" I meant that we should have a display for this type of curve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Discussion
Development

Successfully merging this pull request may close these issues.

Add metrics.gini_index_score()
7 participants