From beaca40f25eaae74c325e7da71fa72489e479561 Mon Sep 17 00:00:00 2001 From: Justin Ormont Date: Tue, 3 Nov 2020 01:49:10 -0800 Subject: [PATCH] maxModels instead of time for AutoML unit test --- test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs b/test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs index bea3f97f3f..24223bc85d 100644 --- a/test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs +++ b/test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs @@ -120,11 +120,11 @@ public void AutoFitRegressionTest(string culture) // the sweeper encounters problems when parsing some strings. // So testing in another culture is necessary. // Furthermore, these issues might only occur after ~70 - // iterations, so more experiment time is needed for this to - // occur. - uint experimentTime = (uint) (culture == "en-US" ? 0 : 180); + // iterations, so setting the internal maxModels parameter. + int maxModels = culture == "en-US" ? 1 : 75; + + var experimentSettings = new RegressionExperimentSettings { MaxModels = maxModels }; - var experimentSettings = new RegressionExperimentSettings { MaxExperimentTimeInSeconds = experimentTime}; if (!Environment.Is64BitProcess) { // LightGBM isn't available on x86 machines @@ -143,11 +143,10 @@ public void AutoFitRegressionTest(string culture) .Execute(trainData, validationData, new ColumnInformation() { LabelColumnName = DatasetUtil.MlNetGeneratedRegressionLabel }); - Assert.True(result.RunDetails.Max(i => i.ValidationMetrics.RSquared > 0.9)); + Assert.True(result.RunDetails.Max(i => i.ValidationMetrics.RSquared) > 0.99); - // Ensure experimentTime allows enough iterations to fully test the internationalization code - // If the below assertion fails, increase the experiment time so the number of iterations is met - Assert.True(culture == "en-US" || result.RunDetails.Count() >= 75, $"RunDetails.Count() = {result.RunDetails.Count()}, below 75"); + // Test the internal maxModels parameter + Assert.True(culture == "en-US" || result.RunDetails.Count() == 75, $"RunDetails.Count() = {result.RunDetails.Count()}, is not 75"); } finally