Skip to content

Textloader behavior for non present columns #3054

@Ivanidzo4ka

Description

@Ivanidzo4ka
MLContext mlContext = new MLContext();
mlContext.Log += MlContext_Log;
var loader = mlContext.Data.CreateTextLoader(new Data.TextLoader.Options()
{
    Columns = new[] { new Data.TextLoader.Column("A", Data.DataKind.Int32, 0),
                      new Data.TextLoader.Column("B", Data.DataKind.Single, 1),
                      new Data.TextLoader.Column("C", Data.DataKind.Single, 2),
                      new Data.TextLoader.Column("D", Data.DataKind.Single, 3),
                      new Data.TextLoader.Column("E", Data.DataKind.Single, 4),
                      new Data.TextLoader.Column("F", Data.DataKind.Single, 5),
                      new Data.TextLoader.Column("G", Data.DataKind.Single, 6),}
                      });
var data =loader.Load("sample.txt");
var pr = data.Preview();
}

private static void MlContext_Log(object sender, LoggingEventArgs e)
{
    Console.WriteLine(e.Message);
}

sample.txt

Right now if I inspect any column other than "A" I would see array of zeros.
I see no messages in log regarding: column with index 1 not found.
I'm not sure why it's zeros and not NaN (so we can treat them as missing values).
I don't know what behavior should TextLoader have, either fail or send warning messages, but I found it strange what we don't do anything right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIIssues pertaining the friendly APIP3Doc bugs, questions, minor issues, etc.questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions