Skip to content

SlotNames for TextLoader are lost #2663

@Ivanidzo4ka

Description

@Ivanidzo4ka

Before refactoring if we had header in file and we read it we filled slot names metadata with values in that header for columns.
This way we can have mapping between field "A" in csv file and slot number 5 in feature vector.

This functionality is lost right now.
Mostly because we split functionality of schema construction which done without file and reading data from file with already defined schema.
If I have this header:
Label A B C D E F G ....
and this source code:

            var reader = mlContext.Data.CreateTextLoader(new Microsoft.ML.Data.TextLoader.Column[] { new Microsoft.ML.Data.TextLoader.Column("Label", Microsoft.ML.Data.DataKind.R4, 0), new Microsoft.ML.Data.TextLoader.Column("Features", Microsoft.ML.Data.DataKind.R4, 1, 100) },
                hasHeader: true, separatorChar: ' ');
            var data = reader.Read("data.txt");

I expect Features column to have SlotNames metadata with values A B C D E F G, etc.

Metadata

Metadata

Assignees

Labels

APIIssues pertaining the friendly APIbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions