Skip to content

Commit

Permalink
Added multiple cultures
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovs1029 committed Oct 29, 2020
1 parent 32f931e commit ff65570
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,32 @@ private void Context_Log(object sender, LoggingEventArgs e)
}

[Theory]
[InlineData(false)]
[InlineData(true)]
public void AutoFitRegressionTest(bool foreignCulture)
[InlineData("en-US")]
[InlineData("ar-SA")]
[InlineData("pl-PL")]
public void AutoFitRegressionTest(string culture)
{
var originalCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);

uint experimentTime = 0;

if (foreignCulture)
if (culture == "ar-SA")
{
// If users run AutoML with a different local, sometimes
// the sweeper encounters problems when parsing some strings.
// So testing in another culture is necessary.
// Furthermore, these issues might only occur after several
// iterations, so more experiment time is needed for this to
// occur.
Thread.CurrentThread.CurrentCulture = new CultureInfo("pl-PL");
experimentTime = 30;

}

else if(culture == "pl-PL")
{
experimentTime = 100;
}

var context = new MLContext(1);
var dataPath = DatasetUtil.GetMlNetGeneratedRegressionDataset();
var columnInference = context.Auto().InferColumns(dataPath, DatasetUtil.MlNetGeneratedRegressionLabel);
Expand All @@ -139,8 +145,7 @@ public void AutoFitRegressionTest(bool foreignCulture)

Assert.True(result.RunDetails.Max(i => i.ValidationMetrics.RSquared > 0.9));

if(foreignCulture)
Thread.CurrentThread.CurrentCulture = originalCulture;
Thread.CurrentThread.CurrentCulture = originalCulture;
}

[LightGBMFact]
Expand Down

0 comments on commit ff65570

Please sign in to comment.