-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Polish train catalog (renaming only) #3030
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
Changes from 3 commits
6ee8a49
5a3372d
0197de6
ea24842
458dcc6
2d55c67
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 |
---|---|---|
|
@@ -484,21 +484,22 @@ internal MulticlassClassificationTrainers(MulticlassClassificationCatalog catalo | |
/// <param name="labelColumnName">The name of the label column in <paramref name="data"/>.</param> | ||
/// <param name="scoreColumnName">The name of the score column in <paramref name="data"/>.</param> | ||
/// <param name="predictedLabelColumnName">The name of the predicted label column in <paramref name="data"/>.</param> | ||
/// <param name="topK">If given a positive value, the <see cref="MulticlassClassificationMetrics.TopKAccuracy"/> will be filled with | ||
/// <param name="topPredictionCount">If given a positive value, the <see cref="MulticlassClassificationMetrics.TopKAccuracy"/> will be filled with | ||
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. Did you also rename 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. We don't need to. 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. Discussed offline. We will do |
||
/// the top-K accuracy, that is, the accuracy assuming we consider an example with the correct class within | ||
/// the top-K values as being stored "correctly."</param> | ||
/// <returns>The evaluation results for these calibrated outputs.</returns> | ||
public MulticlassClassificationMetrics Evaluate(IDataView data, string labelColumnName = DefaultColumnNames.Label, string scoreColumnName = DefaultColumnNames.Score, | ||
string predictedLabelColumnName = DefaultColumnNames.PredictedLabel, int topK = 0) | ||
string predictedLabelColumnName = DefaultColumnNames.PredictedLabel, int topPredictionCount = 0) | ||
{ | ||
Environment.CheckValue(data, nameof(data)); | ||
Environment.CheckNonEmpty(labelColumnName, nameof(labelColumnName)); | ||
Environment.CheckNonEmpty(scoreColumnName, nameof(scoreColumnName)); | ||
Environment.CheckNonEmpty(predictedLabelColumnName, nameof(predictedLabelColumnName)); | ||
Environment.CheckUserArg(topPredictionCount >= 0, nameof(topPredictionCount), "Must be non-negative"); | ||
|
||
var args = new MulticlassClassificationEvaluator.Arguments() { }; | ||
if (topK > 0) | ||
args.OutputTopKAcc = topK; | ||
if (topPredictionCount > 0) | ||
args.OutputTopKAcc = topPredictionCount; | ||
var eval = new MulticlassClassificationEvaluator(Environment, args); | ||
return eval.Evaluate(data, labelColumnName, scoreColumnName, predictedLabelColumnName); | ||
} | ||
|
@@ -673,18 +674,18 @@ internal AnomalyDetectionTrainers(AnomalyDetectionCatalog catalog) | |
/// <param name="labelColumnName">The name of the label column in <paramref name="data"/>.</param> | ||
/// <param name="scoreColumnName">The name of the score column in <paramref name="data"/>.</param> | ||
/// <param name="predictedLabelColumnName">The name of the predicted label column in <paramref name="data"/>.</param> | ||
/// <param name="k">The number of false positives to compute the <see cref="AnomalyDetectionMetrics.DetectionRateAtKFalsePositives"/> metric. </param> | ||
/// <param name="falsePositiveCount">The number of false positives to compute the <see cref="AnomalyDetectionMetrics.DetectionRateAtKFalsePositives"/> metric. </param> | ||
/// <returns>Evaluation results.</returns> | ||
public AnomalyDetectionMetrics Evaluate(IDataView data, string labelColumnName = DefaultColumnNames.Label, string scoreColumnName = DefaultColumnNames.Score, | ||
string predictedLabelColumnName = DefaultColumnNames.PredictedLabel, int k = 10) | ||
string predictedLabelColumnName = DefaultColumnNames.PredictedLabel, int falsePositiveCount = 10) | ||
{ | ||
Environment.CheckValue(data, nameof(data)); | ||
Environment.CheckNonEmpty(labelColumnName, nameof(labelColumnName)); | ||
Environment.CheckNonEmpty(scoreColumnName, nameof(scoreColumnName)); | ||
Environment.CheckNonEmpty(predictedLabelColumnName, nameof(predictedLabelColumnName)); | ||
|
||
var args = new AnomalyDetectionEvaluator.Arguments(); | ||
args.K = k; | ||
args.K = falsePositiveCount; | ||
|
||
var eval = new AnomalyDetectionEvaluator(Environment, args); | ||
return eval.Evaluate(data, labelColumnName, scoreColumnName, predictedLabelColumnName); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ public void RandomizedPcaTrainerBaselineTest() | |
var transformedData = DetectAnomalyInMnistOneClass(trainPath, testPath); | ||
|
||
// Evaluate | ||
var metrics = ML.AnomalyDetection.Evaluate(transformedData, k: 5); | ||
var metrics = ML.AnomalyDetection.Evaluate(transformedData, falsePositiveCount: 5); | ||
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.
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. |
||
|
||
Assert.Equal(0.98667, metrics.AreaUnderRocCurve, 5); | ||
Assert.Equal(0.90000, metrics.DetectionRateAtKFalsePositives, 5); | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
it seems the existing behavior is to just ignore negative values. is that correct ? should we raise an exception if user gives a negative value #Resolved
Uh oh!
There was an error while loading. Please reload this page.
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.
No problem. We throw now. #Resolved