-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
TunedThresholdClassifierCV: add other metrics #29061
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
Comments
I would be against this API. We should limit the internal attribute to the modelling only (currently optimizing a single metric). However, if we have a display, then we can input the model and compute and store the metric. So in terms of usability I think the display should be in charge of storing the metric log. |
Oh, just to be clear, I am not worried about the display/chart. This is more just an example of a manual chart that I might be interested in making. I am mainly concerned with being able to dive into the effect that a different threshold may have. There can be multiple concerns, and a single metrics usually doesn't capture that. What I want is the ability to add metrics, some of which are custom, that can help ensure that optimizing for one thing, say f1 score, does not cause issues else where, say a fairness metric. I am totally fine with optimizing a single metric, that totally makes sense! But I would prefer to also be able to report on other metrics while doing so. |
But once you have the model, this is just an evaluation issue. So by providing a function However, this require an additional line of code because it is not called within the model = TunedThresholdClassifierCV(.., scoring=business_metrics, ...).fit(X_train, y_train)
metrics_log = decision_threshold_curve(
y_test, model.predict_proba(X_test), scoring=[business_metrics, f1_score, ...]
) The advantage here is that you can compute the score on a provided dataset and not only an internal validation set. So you will be able to compare train/test or run it through cross-validation. |
Nop, this is my proposal in #25639 |
Ahhhh sorry, now I see. Yeah, ok, with a visualisation feature like that I suppose you could always do that exercise without using an automated tuner and I also see how that is a separate problem. Fair enough. Closing this one! Thanks for the response. |
Is TunedThresholdClassifierCV with refit=True the same than GridSearchCV using as hyperparameter the threshold? |
|
Describe the workflow you want to enable
I figured that I might use the new tuned thresholder to turn code like this into something that's a bit more like gridsearch with all the parallism benefits.
This data can give me a very pretty plot with a lot of information.
But I think I can't make this chart with the new tuned thresholder in the 1.5 release candidate.
I can do this:
And this gives me data for a pretty plot as well, but it only contains the f1 score. There is no way to add extra metrics in the current implementation.
Describe your proposed solution
Maybe it makes sense to also allow a
metrics
input to the tuned cv estimator. That way, it can still collect any extra metrics that we might be interested in.Describe alternatives you've considered, if relevant
The aforementioned code shows the chart that I am mainly interested in. A single metric never tells me the full story and the extra metrics help prevent me overfit on a single variable. Reality tends to be more complex than what a single metric can provide, so I like to nudge extra context with some (custom) metrics.
Additional context
No response
The text was updated successfully, but these errors were encountered: