scikit-learn / scikit-learn/scikit-learn

DOC add an example on how to optimize a metric with a constraint in TunedThresholdClassifierCV

Open
#28,944 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We merged TunedThresholdClassifierCV in #26120.
However, we don't expose any way to optimize a metric that is constrained by another as one would do when choosing a point on the ROC or PR curves.

We should have an example that shows how to do such optimization as discussed here:
https://github.com/scikit-learn/scikit-learn/pull/26120#pullrequestreview-2038175696

This would be a temporary trick until we settle on the best possible API regarding this constrained scorer.

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 reading the TunedThresholdClassifierCV documentation and the linked discussion in pull request #26120, especially the referenced review. Add an example showing how to optimize one metric subject to a constraint on another, and confirm that the example demonstrates the intended ROC or PR curve use case without depending on a finalized constrained-scorer API.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.