Skip to content

TextLoader().CreateFrom() Unhandled Exception for version 0.2.0 #318

Closed
@helloguo

Description

@helloguo

System information

  • OS Windows 10:
  • .NET Version 2.1.300-rc1-008673:

Issue

  • What did you do?

I move my code from ML.NET version 0.1.0 to ML.NET version 0.2.0. I have a data structure FlightData looks like following. Then I use pipeline.Add(new TextLoader(trainingDataSet).CreateFrom<FlightData>(useHeader: true, separator: ',', allowQuotedStrings:true)); to load the data.

    public class FlightData
    {
        [Column(ordinal: "0")]
        public float QUARTER;
        [Column(ordinal: "1")]
        public float MONTH;
        [Column(ordinal: "2")]
        public float DAY_OF_MONTH;
        [Column(ordinal: "3")]
        ....
    }
  • What happened?

Error message:

Unhandled Exception: System.InvalidOperationException: DAY_OF_MONTH is not alphanumeric.
   at Microsoft.ML.Data.TextLoader.CreateFrom[TInput](Boolean useHeader, Char separator, Boolean allowQuotedStrings, Boolean supportSparse, Boolean trimWhitespace)

After looking at the error msg and ML.NET source code https://github.com/dotnet/machinelearning/blob/master/src/Microsoft.ML/Data/TextLoader.cs#L87, I change DAY_OF_MONTH to DAYOFMONTH. Then the error disappears. But it's common to use _ in the variable names.

  • What did you expect?

I can use _ in variable names, which are part of Input fed to TextLoader.

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions