Skip to content

InvalidOperationException: Source column 'Label' is required but not found. #117

Closed
@zeahmed

Description

@zeahmed

System information

.NET Command Line Tools (2.1.4)

Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190

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

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Issue

When decorating input type field with "Label" attribute as shown in the following

class CoreFxIssue
{
    [Column("0")]
    public string ID;

    [Column("1", name: "Label")]
    public string Area;

    [Column("2")]
    public string Title;

    [Column("3")]
    public string Description;
}

public class CoreFxIssuePrediction
{
    [ColumnName("PredictedLabel")]
    public string Area;
}

The training breaks with exception shown below when using "Label" in a transform in the pipeline.
image

The problem is when defining input/output schema from input/output type, the column names are not properly loaded. Input type uses ColumnAttribute class while Output type uses ColumnNameAttribute while loading custom attributes ( c.f. https://github.com/dotnet/machinelearning/blob/master/src/Microsoft.ML.Api/SchemaDefinition.cs).

Solution

The solution is to check for both type of custom attributes (ColumnAttribute, ColumnNameAttribute) and load names properly and add a few tests to cover this issue.

Side Effects

This is the side effect of using custom attribute "Label" on any field in input type.

When decorating "Area" field with "Label" attribute in CoreFxIssue
type above, the "Area" field is no longer available in the pipeline. "Area" is replaced with "Label" i.e. use "Label" for "Area" in the pipeline. Need to highlight it in the documentation properly.

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