-
Notifications
You must be signed in to change notification settings - Fork 403
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
FEAT export InterpolatedThresholder as a public object and update its API (e.g., rename an argument) #918
base: main
Are you sure you want to change the base?
FEAT export InterpolatedThresholder as a public object and update its API (e.g., rename an argument) #918
Changes from all commits
495fc5c
bca4f9f
c3b6406
3e9ec78
6ffdb89
40c590b
dc295b2
9c77be1
d6fd7b6
69931c1
af5cd03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,13 @@ class InterpolatedThresholder(BaseEstimator, MetaEstimatorMixin): | |
|
||
At prediction time, the predictor takes as input both standard and sensitive features. | ||
Based on the values of sensitive features, it then applies a randomized thresholding | ||
transformation according to the provided `interpolation_dict`. | ||
transformation according to the provided `threshold_interpolation`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change? if you don't like the original, we should go for something more concise. maybe something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Info isn't a great name. Everything is "info", yet we don't call "width" variables "width_info". It's a stylistic improvement as well as a description improvement: interpolation and threshold are the two important things worth mentioning IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't dislike it, but that's just p0 and p1 🙂 It's really not a bad name though... |
||
|
||
Parameters | ||
---------- | ||
estimator : | ||
base estimator | ||
|
||
interpolation_dict : dict | ||
threshold_interpolation : dict | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment above re. naming. By the way, do we like the structure of this argument? The main reason why I've originally excluded this estimator from the module was that I wasn't sure we all liked this deep structure and I didn't want to commit to it... I usually prefer "shallower" input arguments. |
||
maps sensitive feature values to `Bunch` that describes the | ||
interpolation transformation via the following fields: | ||
|
||
|
@@ -78,10 +77,10 @@ class InterpolatedThresholder(BaseEstimator, MetaEstimatorMixin): | |
[Online]. Available: https://arxiv.org/abs/1610.02413. | ||
""" | ||
|
||
def __init__(self, estimator, interpolation_dict, prefit=False, | ||
def __init__(self, estimator, threshold_interpolation, prefit=False, | ||
predict_method='deprecated'): | ||
self.estimator = estimator | ||
self.interpolation_dict = interpolation_dict | ||
self.threshold_interpolation = threshold_interpolation | ||
self.prefit = prefit | ||
self.predict_method = predict_method | ||
|
||
|
@@ -141,7 +140,7 @@ def _pmf_predict(self, X, *, sensitive_features): | |
enforce_binary_labels=False) | ||
|
||
positive_probs = 0.0*base_predictions_vector | ||
for a, interpolation in self.interpolation_dict.items(): | ||
for a, interpolation in self.threshold_interpolation.items(): | ||
interpolated_predictions = \ | ||
interpolation.p0 * interpolation.operation0(base_predictions_vector) + \ | ||
interpolation.p1 * interpolation.operation1(base_predictions_vector) | ||
|
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.
You'll also want to export
ThresholdOperation
. That's another structured object, where we should review whether we like its current API enough to make it external.