Skip to content

Auto.ML: Fix issue when parsing float string fails on pl-PL culture set using Regression Experiment #5163

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

Merged
merged 14 commits into from
Oct 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added multiple cultures
  • Loading branch information
antoniovs1029 committed Oct 29, 2020
commit ff655708bafbf8d0e98dd52bb0803be4fbee7b39
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