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

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

Closed
zeahmed opened this issue May 10, 2018 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@zeahmed
Copy link
Contributor

zeahmed commented May 10, 2018

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.

@TomFinley
Copy link
Contributor

Thanks much for the clear description in the issue, as well as the prompt fix @zeahmed !

@zeahmed zeahmed closed this as completed May 11, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants