Skip to content

Add metrics.gini_index_score() #28535

Open

Description

@yonil7

Describe the workflow you want to enable

The Gini index metric (that is based on Lorenz curve) is widely used in the insurance industry for evaluating the performance (ranking power) of various risk models.

Describe your proposed solution

2 sklearn examples already includes code for calculating the gini index metric here and here

Related to #28534

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Activity

  1. fkdosilovic commented on Feb 28, 2024

    @fkdosilovic
    Contributor

    Recently, there was a discussion about this in #28144 (PR #28156).

    Quote from one of the core developers (#28144 (comment)):

    You will find this simple formula implemented in some of our examples, too. Because it is so simple, I‘m against adding it to the already large metrics API.

  2. yonil7 commented on Feb 28, 2024

    @yonil7
    Author

    I'm not sure, but there seems to be 2 different gini index/coefficient definitions:

    1. Defined on the output of a binary classifier:
      Defines here: https://en.wikipedia.org/wiki/Gini_coefficient#Relation_to_other_statistical_measures and in roc_auc_score() notes (gini = 2 * roc_auc - 1)

    2. Defined on a more general float variable. (not necessarily the output of a binary classifier):
      Defines here: https://en.wikipedia.org/wiki/Gini_coefficient and in this code example:

      ordered_samples, cum_claims = lorenz_curve(y_true, y_pred, exposure)
      gini = 1 - 2 * auc(ordered_samples, cum_claims)

      Note that this code does not use roc_auc_score(), it uses lorenz_curve() and then calculate the area under the Lorenz curve (not the area under the ROC curve) using auc()

  3. fkdosilovic commented on Feb 28, 2024

    @fkdosilovic
    Contributor

    You are right, but I'm assuming that a similar argument (too simple to include in the library) could be made for Gini coefficient you are requesting (sklearn/core-devs will know better).

  4. lorentzenchr commented on Mar 8, 2024

    @lorentzenchr
    Member
  5. linked a pull request that will close this issue[MRG] FEA Lift metric and curve #21320on Mar 8, 2024
  6. removed
    Needs Triage
    on Mar 11, 2024
  7. lorentzenchr commented on Mar 20, 2024

    @lorentzenchr
    Member

    Almost a duplicate: #10003.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions