-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Cannot produce a Precision-Recall Curve from our Binary Classification Evaluator #2645
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
Thanks for filing the issue @rogancarr, this is clearly a lack of functionality but we can surely do this post March. |
@shauheen Sounds good! The scenario is technically blocked, but there is a workaround (documented above) because our APIs are so flexible. |
That workaround looks pretty complex for a getting started sample. We cannot use the I hope we can fix/simplify this for 0.12 or by v1.0 in any case? |
@CESARDELATORRE Current plan is for post-v1 @shauheen |
@asthana86 @shauheen @eerhardt - So, shall we remove the "Spam Detection" sample from the repo? |
I'd be happy to help, but let's first resolve if this is in or out for V1. |
This along with #2465 would be stretch goals. At the moment we should not take these. |
We do have functionality that calculates PR curve, its just we dont expose it yet (see internal):
So Arguments need to be public and our BinaryClassifier Evaluator should accept them
|
I don't think we need to make the arguments public necessarily. These mostly have to do with how we calculate the AU(PR|RO)C. I'd hold off on those for v1.0. What we need is a way to somehow return the calculated points for the curve through the API. |
@rogancarr I am specifically pointing out this one:
If its not set (by default its 0) then no PR calculations are happening. It has to be set to have points calculated. |
Let's see how the API comes along and we can work through once we have running code. I do think that this set of arguments seem a bit weird. I haven't seen the code, but I would expect the AU(RO|PR)C to need a (RO|PR)-curve calculation :) [Argument(ArgumentType.AtMostOnce, HelpText = "The number of samples to use for p/r curve generation. Specify 0 for no p/r curve generation", ShortName = "numpr")]
public int NumRocExamples;
[Argument(ArgumentType.AtMostOnce, HelpText = "The number of samples to use for AUC calculation. If 0, AUC is not computed. If -1, the whole dataset is used", ShortName = "numauc")]
public int MaxAucExamples = -1;
[Argument(ArgumentType.AtMostOnce, HelpText = "The number of samples to use for AUPRC calculation. Specify 0 for no AUPRC calculation", ShortName = "numauprc")]
public int NumAuPrcExamples = 100000; |
@rogancarr @Ivanidzo4ka @TomFinley |
That seems fine. In fact that is the correct solution, not just in the short term. Probably as an overload, or even a differently named evaluate method on the context, something like
I disagree with that rather entirely, and I feel that we need to be clear on this point. Entry-points and command line have their own little "interface" due to their own unique infrastructure -- we produce "Unifying" them is what we did with the ML.NET v0.1 API: a "straight" conversion of this same infrastructure. This we know results in a terrible API. In fact all of the work we've been doing for the past year starting with #371 and onwards in one way or another has been making an actual real honest-to-god C# API, rather than going down what we know is that bad path. So, this is not something we will be doing post v1 unless we have forgotten our experiences. |
In the Supported Scenarios for V1 (see #2498) we want to be able to easily plot a PR curve from output of the evaluator.
This is not currently possible in the current set of APIs*. As detailed in #2465, we cannot set a threshold on a binary classification prediction, so we cannot loop over the various thresholds. Furthermore, the Evaluator, while it has enough information to return lists of precisions and recalls at the various cutoffs, does not have an avenue to return this information.
* Well, actually this is possible using custom mappers like so:
(e.g. by reading the IDataView as an enumerable and creating a dictionary of observed values)
a. Write a custom mapper to produce PredictedLabel at that probability threshold.
b. Calculate Precision and Recall with these labels.
However, it doesn't seem like this workaround qualifies as satisfying the V1 Scenario — it's a more advanced use of the APIs, and it requires an individual to understand the ins-and-outs of calculating PR curves
The text was updated successfully, but these errors were encountered: