Skip to content

DOC Need Gini coefficient implementation #28144

Closed

Description

@dzisandy

Describe the workflow you want to enable

Hello there!
For many reasons for classical binary classifications in different areas of business the Gini Score is used.
The Gini score is calculated as follows: Gini=2×ROC AUC−1
The recent implementation of sklearn.metrics.roc_auc_score https://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html requires the formula above to be implemented.

The current functionality doesn't allow this.

This simple fuction will allow many data scientists to clean up their code.

Thanks in advance!

Describe your proposed solution

My suggestion is to add this simple function gini_score in sklearn.metrics described as gini_score = 2*roc_auc_score - 1.

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Activity

  1. lorentzenchr commented on Jan 16, 2024

    @lorentzenchr
    Member

    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.

    We could, however, improve the doc and mention Gini in

  2. removed
    Needs Triage
    on Jan 16, 2024
  3. dzisandy commented on Jan 17, 2024

    @dzisandy
    ContributorAuthor

    I strongly agree, that this fact can be written in docstring. How’s about adding Gini as attribute of roc_auc_score?

  4. glemaitre commented on Jan 17, 2024

    @glemaitre
    Member

    I would not add as attribute since attribute means that this is the input parameters.

    However, we can add a Notes section where we can mentioned the Gini coefficient and the equivalence with the ROC AUC.

  5. glemaitre commented on Jan 17, 2024

    @glemaitre
    Member

    @dzisandy do you want to make a pull-request?

  6. dzisandy commented on Jan 17, 2024

    @dzisandy
    ContributorAuthor

    @glemaitre it will be great. So we want to modify only the Notes section in doc string?

  7. glemaitre commented on Jan 17, 2024

    @glemaitre
    Member

    So we want to modify only the Notes section in doc string?

    Indeed. If no the Notes section does not exist we need to create one. We need to follow the numpydoc format: https://numpydoc.readthedocs.io/en/latest/format.html (the ordering is particularly important otherwise the CIs will fail).

  8. changed the title [-]Need Gini coefficient implementation[/-] [+]DOC Need Gini coefficient implementation[/+] on Jan 17, 2024
  9. dzisandy commented on Jan 17, 2024

    @dzisandy
    ContributorAuthor

    @glemaitre created finally request.

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