Skip to content

WIP Elkan optimal variable threshold decision making #29150

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented May 31, 2024

Draft PR that builds on top of #29149. The diff will be much smaller once #29149 is merged. The new stuff in this PR is the proof of concept code at the end of the example (that is, 0578617).

I experimented a bit with a follow-up on the work on TunedThresholdClassifierCV to see how beneficial it would be to allow hard decisions to optimize a cost model at prediction time given calibrated probabilistic predictions.

The results look promising on the transaction fraud task. This strategy seem to further improve on using tuned fixed decision thresholds.

Note: this is just a proof of concept at this stage, this PR is not meant to be reviewed for merge as this, but I think this idea is worth exploring.

/cc @glemaitre @lorentzenchr @aperezlebel @GaelVaroquaux

Copy link

github-actions bot commented May 31, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: a1b997e. Link to the linter CI: here

@glemaitre glemaitre self-requested a review May 31, 2024 12:25
@ogrisel
Copy link
Member Author

ogrisel commented Jun 5, 2024

I fixed 2 bugs in a1b997e. Now the dependency of the optimal threshold w.r.t. the amount makes sense: the higher the amount of the transaction, the lower the optimal threshold to decide that a transaction is fraudulent and the average threshold value if very close to what TunedThresholdClassifierCV finds empirically.

The general conclusions of the notebook still hold:

  • using a fixed threshold based on the theoretical formula is competitive with empirical tuning with cross-val, especially when the underlying model is recalibrated with isotonic regression,
  • using variable threshold decision making works a even a bit better but really requires well calibrated probabilistic classifier.

However, using variable threshold decision making is not that much a game changer compared to keeping a fixed threshold. This is likely very problem dependent though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant