From 0f7dd6bd4fd29654847f3aff4bd413717b04a467 Mon Sep 17 00:00:00 2001 From: Igor Fesenko Date: Wed, 9 May 2018 16:43:51 +0300 Subject: [PATCH] Fix reversed hyperparameters in Scenarios Tests. Closes #25. --- .../Scenarios/SentimentPredictionTests.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs b/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs index 131b8c02db..608cbef144 100644 --- a/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs +++ b/test/Microsoft.ML.Tests/Scenarios/SentimentPredictionTests.cs @@ -32,8 +32,8 @@ public void TrainAndPredictSentimentModelTest() OutputTokens = true, StopWordsRemover = new PredefinedStopWordsRemover(), VectorNormalizer = TextTransformTextNormKind.L2, - CharFeatureExtractor = new NGramNgramExtractor() { NgramLength = 2, AllLengths = true }, - WordFeatureExtractor = new NGramNgramExtractor() { NgramLength = 3, AllLengths = false } + CharFeatureExtractor = new NGramNgramExtractor() { NgramLength = 3, AllLengths = false }, + WordFeatureExtractor = new NGramNgramExtractor() { NgramLength = 2, AllLengths = true } }); pipeline.Add(new FastTreeBinaryClassifier() { NumLeaves = 5, NumTrees = 5, MinDocumentsInLeafs = 2 }); @@ -65,16 +65,16 @@ public void TrainAndPredictSentimentModelTest() var evaluator = new BinaryClassificationEvaluator(); BinaryClassificationMetrics metrics = evaluator.Evaluate(model, testData); - Assert.Equal(.7222, metrics.Accuracy, 4); - Assert.Equal(.9643, metrics.Auc, 1); - Assert.Equal(.96, metrics.Auprc, 2); + Assert.Equal(.5556, metrics.Accuracy, 4); + Assert.Equal(.8, metrics.Auc, 1); + Assert.Equal(.87, metrics.Auprc, 2); Assert.Equal(1, metrics.Entropy, 3); - Assert.Equal(.7826, metrics.F1Score, 4); - Assert.Equal(.812, metrics.LogLoss, 3); - Assert.Equal(18.831, metrics.LogLossReduction, 3); + Assert.Equal(.6923, metrics.F1Score, 4); + Assert.Equal(.969, metrics.LogLoss, 3); + Assert.Equal(3.083, metrics.LogLossReduction, 3); Assert.Equal(1, metrics.NegativePrecision, 3); - Assert.Equal(.444, metrics.NegativeRecall, 3); - Assert.Equal(.643, metrics.PositivePrecision, 3); + Assert.Equal(.111, metrics.NegativeRecall, 3); + Assert.Equal(.529, metrics.PositivePrecision, 3); Assert.Equal(1, metrics.PositiveRecall); ConfusionMatrix matrix = metrics.ConfusionMatrix; @@ -88,10 +88,10 @@ public void TrainAndPredictSentimentModelTest() Assert.Equal(0, matrix[0, 1]); Assert.Equal(0, matrix["positive", "negative"]); - Assert.Equal(5, matrix[1, 0]); - Assert.Equal(5, matrix["negative", "positive"]); - Assert.Equal(4, matrix[1, 1]); - Assert.Equal(4, matrix["negative", "negative"]); + Assert.Equal(8, matrix[1, 0]); + Assert.Equal(8, matrix["negative", "positive"]); + Assert.Equal(1, matrix[1, 1]); + Assert.Equal(1, matrix["negative", "negative"]); } public class SentimentData