Machinelearning: How to ignore a column

Created on 6 Jul 2018  路  5Comments  路  Source: dotnet/machinelearning

System information

  • OS version/distro: Win 10
  • .NET Version (eg., dotnet --info): 2.1.201

Issue

  • What did you do?
    I added a custom column in my input data type. It holds a DateTime. I need it for stats but not for learning. I never "copy" it to the "Features" column. I also added
new ColumnDropper() { Column = new []{ "PlannedStart"} }
  • What happened?
    I got an ArgumentOutOfRangeException: Could not determine an IDataView type for member ...

  • What did you expect?

I expected it to just ignore the column.

question

Most helpful comment

I'm not entirely certain what mechanism we're using to do this, but the field attributes seem to be declared in this file. One of the attributes available is the so-called NoColumn attribute, seen here:

https://github.com/dotnet/machinelearning/blob/828dc227f4d7346e11094479c7a2e443addc8102/src/Microsoft.ML.Api/SchemaDefinition.cs#L119-L123

From its description, it may do what you want.

All 5 comments

I think if you don't include the column in the "features" column then it is considered to be ignored.

Also, you can just not include a property for that column in the model that represents the CSV row.

Unfortunately, that won't work. As soon as I add any other fields to the class ML.NET will want to do something with it. I solved the problem with deriving the class to a richer class which holds the fields I want. Seems to work

I'm not entirely certain what mechanism we're using to do this, but the field attributes seem to be declared in this file. One of the attributes available is the so-called NoColumn attribute, seen here:

https://github.com/dotnet/machinelearning/blob/828dc227f4d7346e11094479c7a2e443addc8102/src/Microsoft.ML.Api/SchemaDefinition.cs#L119-L123

From its description, it may do what you want.

[NoColumn] works! Thanks Tom.

Hi Rauhs...
I have the same problem that I added a Date column in the input class

public class ItemStock
    {
        [Column("0")]
        public string CarID;

        [Column("1")]
        public float LocID;

        **[Column("2")]
        public DateTime Date;**

        [Column("3")]
        public float Punctured;
    }

I am having the error "Could not determine an IDataView type for member Date"...
Plz let me know how to resolve that...

Was this page helpful?
0 / 5 - 0 ratings