PCA Anomaly Detection Threshold#4039
Merged
artidoro merged 4 commits intodotnet:masterfrom Aug 2, 2019
Merged
Conversation
ganik
reviewed
Jul 26, 2019
| [BestFriend] | ||
| internal AnomalyPredictionTransformer(IHostEnvironment env, TModel model, DataViewSchema inputSchema, string featureColumn, | ||
| float threshold = 0f, string thresholdColumn = DefaultColumnNames.Score) | ||
| float threshold = 0.5f, string thresholdColumn = DefaultColumnNames.Score) |
Member
There was a problem hiding this comment.
float threshold = 0.5f, [](start = 12, length = 23)
Why 0.5? Why not 0.1 or 0.05?
Contributor
Author
There was a problem hiding this comment.
As you point out it is arbitrary. What do you suggest?
ganik
reviewed
Jul 26, 2019
| /// <param name="model">A trained <see cref="AnomalyPredictionTransformer{TModel}"/>.</param> | ||
| /// <param name="threshold">The new threshold value that will be used to determine the label of a data point | ||
| /// based on the predicted score by the model.</param> | ||
| public AnomalyPredictionTransformer<TModel> ChangeModelThreshold<TModel>(AnomalyPredictionTransformer<TModel> model, float threshold) |
Member
There was a problem hiding this comment.
float threshold [](start = 125, length = 15)
I suggest to add the Threshold to option for constructor, like we do for majority of other transformers
Contributor
Author
There was a problem hiding this comment.
I can also add that to a constructor but that will change the signature of the constructor, so I can only a new one with this additional parameter. Is that what you would like me to do?
Where else are we setting the threshold from the constructor? I don't remember seeing that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3990
In this PR I change the default threshold for PCA anomaly detection to 0.5 (see the issue for discussion on what that means).
I also add a method to change the threshold from MlContext in the same spirit as the BinaryClassification ChangeThreshold method.
I update the samples and add a test for the new method.