Skip to content

LoadColumn attribute #2420

Open
Open

Description

System Information (please complete the following information):

  • Model Builder Version (available in Manage Extensions dialog): 16.14.0.2255902
  • Visual Studio Version

Describe the bug

  • On which step of the process did you run into an issue: Model Builder
  • Clear description of the problem: When using model builder to train a model, the resulting model input class does not have the loadcolumn attribute, which makes my existing code to consume the ML model (make predictions using data from a .csv file) useless. In previous posts, it was mentioned that this was fixed in versions 16.14.0, however this does not seem to be the case.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Here is a snippet of my code. It fails when I try use LoadFromTextFile.
static void Main(string[] args)
{
Console.WriteLine("Hello World!");

        ////begin
        ///


        //create mlContext
        var mlContext = new MLContext();

        //load data from csv file
        
        IDataView testData = mlContext.Data.LoadFromTextFile<MLModel1.ModelInput>(testDataPath, separatorChar: ',', hasHeader: true);
                   
        // Set-up prediction pipeline
        DataViewSchema predictionPipelineSchema;
        ITransformer predictionPipeline = mlContext.Model.Load("MLModel.zip", out predictionPipelineSchema);

        //apply transformations and generate predictions
        IDataView predictions = predictionPipeline.Transform(testData);

        //inspect predicted values
        var predictionColumn = predictions.GetColumn<string>("PredictedLabel").ToArray();
        //IEnumerable<float> scoreColumn = predictions.GetColumn<float>("Score").ToList();

        //// Create an IEnumerable of ModelOutput objects from IDataView
        IEnumerable<MLModel1.ModelOutput> predictionsEnumerable =
            mlContext.Data.CreateEnumerable<MLModel1.ModelOutput>(predictions, reuseRowObject: true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions