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

NoColumn Attribute not recognized by TextLoaderSaverCatalog.LoadFromTextFile Method #5443

Closed
ghost opened this issue Oct 20, 2020 · 3 comments
Assignees
Labels
Awaiting User Input Awaiting author to supply further info (data, model, repro). Will close issue if no more info given. loadsave Bugs related loading and saving data or models P2 Priority of the issue for triage purpose: Needs to be fixed at some point.

Comments

@ghost
Copy link

ghost commented Oct 20, 2020

System information

  • OS version/distro: Windows 10/ Home

  • .NET Version (eg., dotnet --info):
    .NET Core SDK (reflecting any global.json):
    Version: 3.1.101
    Commit: b377529961

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\

Issue

  • What did you do?
    Tried to run the following code to load my training data out of a CSV file. I've been using the AutoML CLI to this point to generate my models, and thought I'd take crack at doing it via my .NET code. The ModelInput class has been working at runtime to load my metrics into, and pass to the model trained using the CLI, for predictions, even with the extra columns in the class.
MLContext mlContext = new MLContext();
IDataView trainDataView = mlContext.Data.LoadFromTextFile<ModelInput>("data/data.csv", hasHeader: true);
  • What happened?
    Get error:
System.InvalidOperationException: Property 'Change_Tomorrow' is missing the LoadColumnAttribute attribute
   at Microsoft.ML.Data.TextLoader.CreateTextLoader[TInput](IHostEnvironment host, Options options, IMultiStreamSource dataSample)
   at Microsoft.ML.Data.TextLoader.CreateTextLoader[TInput](IHostEnvironment host, Boolean hasHeader, Char separator, Boolean allowQuoting, Boolean supportSparse, Boolean trimWhitespace, IMultiStreamSource dataSample)
   at Microsoft.ML.TextLoaderSaverCatalog.LoadFromTextFile[TInput](DataOperationsCatalog catalog, String path, Char separatorChar, Boolean hasHeader, Boolean allowQuoting, Boolean trimWhitespace, Boolean allowSparse)
  • What did you expect?
    Data to be loaded from my csv file into an IDataView

Source code / logs

  • ModelInput Class
    This is a trimmed down version of my ModelInput class. Note that the "Index(0)" attribute and the "Ignore" attribute come from the "CsvHelper" Nuget package, as I use this ModelInput class for both writing to Csv, and for input for model predictions.
    public class ModelInput
    {
        [ColumnName("Country"), LoadColumn(0), Index(0)]
        public string Country { get; set; }
        [Ignore, NoColumn]
        public float Change_Tomorrow { get; set; }
        [Ignore, NoColumn]
        public DateTime DateTomorrow { get; set; }
    }

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

@mstfbl
Copy link
Contributor

mstfbl commented Oct 20, 2020

Hi @scyentyfyc ,

Thank you for reporting this issue. Can you please attach the CSV file you're trying to load? I will attempt to replicate your issue and let you know of a fix. Thanks.

@mstfbl mstfbl added Awaiting User Input Awaiting author to supply further info (data, model, repro). Will close issue if no more info given. loadsave Bugs related loading and saving data or models P2 Priority of the issue for triage purpose: Needs to be fixed at some point. labels Oct 20, 2020
@mstfbl mstfbl self-assigned this Oct 20, 2020
@mstfbl
Copy link
Contributor

mstfbl commented Oct 21, 2020

Hi @scyentyfyc ,

I attempted to repro your issue with a small fake CSV dataset according to ModelInput, and I was not able to obtain the InvalidOperationException you reported. Please feel free to share the CSV file with which you've reported this exception.

@mstfbl
Copy link
Contributor

mstfbl commented Oct 23, 2020

Closing issue as needed dataset to debug was not provided. @scyentyfyc please feel free to provide it to continue the investigation of this issue. Thanks.

@mstfbl mstfbl closed this as completed Oct 23, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Mar 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Awaiting User Input Awaiting author to supply further info (data, model, repro). Will close issue if no more info given. loadsave Bugs related loading and saving data or models P2 Priority of the issue for triage purpose: Needs to be fixed at some point.
Projects
None yet
Development

No branches or pull requests

1 participant