Skip to content
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

[AutoML] Fix for Column inference for R4 type column in different cultures #3731

Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;

namespace Microsoft.ML.AutoML
{
Expand All @@ -25,7 +26,7 @@ public static bool TryParse(in TX src, out R4 dst)
dst = R4.NaN;
return true;
}
if (float.TryParse(str, out dst))
if (float.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dst))
Copy link
Contributor

@justinormont justinormont May 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea what the ML.NET TextLoader does? Does the TextLoader handle reading as InvariantCulture correctly?

I'm worried that we'll infer the value is a number in the AutoML code, then the TextLoader won't be able to read the value since it will read as the local culture. If so, we'd likely want to also correct the TextLoader.

{
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;
using System.Linq;
using System.Text;

Expand Down Expand Up @@ -144,7 +145,7 @@ public SweepableFloatParam(float min, float max, float stepSize = -1, int numSte

public override void SetUsingValueText(string valueText)
{
RawValue = float.Parse(valueText);
RawValue = float.Parse(valueText, CultureInfo.InvariantCulture);
}

public override SweepableParam Clone() =>
Expand Down