scikit-learn / scikit-learn/scikit-learn

Improve `pos_label` switching for metrics

Open
#30,909 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

RFC
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

Supercedes #26758

Switching pos_label for metrics, involves some manipulation for predict_proba (switch column you pass) and decision_function (for binary, multiply by -1) as you must pass the values for the positive class.

In discussions in #26758 we thought of two options:

This is a RFC to discuss if we prefer one, or both options.

cc @glemaitre and maybe @ogrisel ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the discussion in #26758 and the two private functions in sklearn/utils/_response.py: _process_decision_function and _process_predict_proba. Compare the proposed example and public-API options, then confirm the preferred direction and its expected behavior when switching pos_label for predict_proba and decision_function.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.