From 2aa195d10994a92103d9dbdad485df5fe292ea9d Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Tue, 10 Mar 2020 00:46:54 -0700 Subject: [PATCH 1/2] fix LdaWorkoutEstimatorCore --- test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs b/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs index 9ab4a7fd9d..57757e2705 100644 --- a/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs +++ b/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs @@ -714,7 +714,6 @@ public void LdaWorkout() } [Fact] - [Trait("Category", "SkipInCI")] public void LdaWorkoutEstimatorCore() { var ml = new MLContext(1); @@ -729,7 +728,7 @@ public void LdaWorkoutEstimatorCore() builder.AddColumn("F1V", NumberDataViewType.Single, data); var srcView = builder.GetDataView(); - var est = ml.Transforms.Text.LatentDirichletAllocation("F1V"); + var est = ml.Transforms.Text.LatentDirichletAllocation("F1V", resetRandomGenerator: true); TestEstimatorCore(est, srcView); } From b5306a619099d7ceac2aab85b5ba4212c2d05cb1 Mon Sep 17 00:00:00 2001 From: frank-dong-ms <55860649+frank-dong-ms@users.noreply.github.com> Date: Tue, 10 Mar 2020 12:19:12 -0700 Subject: [PATCH 2/2] add comments --- test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs b/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs index 57757e2705..94a349a09e 100644 --- a/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs +++ b/test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs @@ -728,6 +728,12 @@ public void LdaWorkoutEstimatorCore() builder.AddColumn("F1V", NumberDataViewType.Single, data); var srcView = builder.GetDataView(); + //Attention: resetRandomGenerator needs to be true here as multiple compare will be performed later. + //In lda_engine, a queue of samples with size of (num_of_threads - 2) will be created at first, + //each time a compare is performed the internal status of one sample (random number: rng_) is changed, + //so if size of queue is smaller the number of compare performed, dirty data will be used again for calculation + //and cause issue. set resetRandomGenerator to true will reset the random number rng_ every time + //before lda calculation. var est = ml.Transforms.Text.LatentDirichletAllocation("F1V", resetRandomGenerator: true); TestEstimatorCore(est, srcView); }