-
Notifications
You must be signed in to change notification settings - Fork 126
Binary risk control - implementation batch 1 #735
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
Binary risk control - implementation batch 1 #735
Conversation
f883ca9
to
13462fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements binary classification risk control in its simplest form, focusing on mono-risk and unidimensional lambda using thresholding on predict_proba. The implementation includes cleanup of existing risk control code and introduction of new binary classification risk control components.
Key changes:
- Remove unnecessary components from existing LTT procedure (lambda=None check, p_values output)
- Add support for array-based n_obs in p-value calculations for binary classification scenarios
- Implement BinaryClassificationRisk class with predefined instances for precision, recall, and accuracy
- Introduce BinaryClassificationController for threshold-based binary classification risk control
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
mapie/control_risk/ltt.py | Remove p_values return, lambda=None check, and add array support for n_obs |
mapie/control_risk/p_values.py | Add array support for n_obs parameter in Hoeffding-Bentkus p-value computation |
mapie/risk_control.py | Add BinaryClassificationRisk class and predefined risk instances |
mapie/risk_control_draft.py | Implement BinaryClassificationController with threshold-based risk control |
mapie/tests/test_control_risk.py | Update tests for LTT changes and add n_obs array testing |
mapie/tests/test_risk_control.py | Add comprehensive tests for BinaryClassificationRisk instances |
mapie/init.py | Remove risk_control_draft from exports |
Comments suppressed due to low confidence (2)
mapie/tests/test_risk_control.py:848
- The test should verify the specific condition that leads to None result (effective_sample_size == 0) rather than using a general elif clause. Consider adding an explicit assertion that effective_sample_func returns 0 when result is None.
elif result is None:
mapie/risk_control_draft.py:18
- The entire BinaryClassificationController class is marked with pragma: no cover, indicating missing test coverage. This class implements core functionality and should have comprehensive unit tests.
class BinaryClassificationController: # pragma: no cover
8f2a127
to
ed18964
Compare
37c79dc
to
4404ad1
Compare
4404ad1
to
5811aa9
Compare
- Use BinaryClassificationRisk to compute risk - Use warning instead of error when risk is not controled. Throw error when predicting - Remove useless check on lambda=None in ltt_procedure - Remove useless p_values from ltt_procedure outputs - Add possibility to pass an array of n_obs to ltt_procedure and subsequent p-values calculations (needed for binary classification)
- Fix bentkus_p_value calculation - Fix and move higher_is_better logic in the same place - Implement unit test for BinaryClassificationRiskControl - Fix parametrizing of existing test
… positive predictions)
d08fbea
to
e661adb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## binary-risk-control #735 +/- ##
=======================================================
Coverage ? 100.00%
=======================================================
Files ? 56
Lines ? 6205
Branches ? 355
=======================================================
Hits ? 6205
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.