You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class IrisData
{
[Column("0")]
public float SepalLength;
[Column("1")]
public float SepalWidth;
[Column("2")]
public float PetalLength;
[Column("3")]
public float PetalWidth;
[Column("4")]
[ColumnName("Label")]
public string Label;
}
If I changed field name from Label to other name(like Label_1)
public class IrisData
{
[Column("0")]
public float SepalLength;
[Column("1")]
public float SepalWidth;
[Column("2")]
public float PetalLength;
[Column("3")]
public float PetalWidth;
[Column("4")]
[ColumnName("Label")]
public string Label_1;
}
It will throw Exception(Source column 'Label' not found):
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Private.CoreLib.dll: 'Exception has been thrown by the target of an invocation.'
Inner exceptions found, see $exception in variables window for more details.
Innermost exception System.ArgumentOutOfRangeException : Source column 'Label' not found
at Microsoft.ML.Runtime.Data.OneToOneTransformBase.Bindings.Create(OneToOneTransformBase parent, OneToOneColumn[] column, ISchema input, ITransposeSchema transInput, Func`2 testType)
at Microsoft.ML.Runtime.Data.OneToOneTransformBase..ctor(IHostEnvironment env, String name, OneToOneColumn[] column, IDataView input, Func`2 testType)
at Microsoft.ML.Runtime.Data.TermTransform..ctor(ArgumentsBase args, ColumnBase[] column, IHostEnvironment env, IDataView input)
at Microsoft.ML.Runtime.Transforms.TextAnalytics.TermTransform(IHostEnvironment env, Arguments input)
Fix
It can be fixed by setting name in ColumnAttribute
[Column("4","Label")]
public string Label_1;
The text was updated successfully, but these errors were encountered:
Issue
ML.NET Tutorial define IrisData class like this:
If I changed field name from Label to other name(like Label_1)
It will throw Exception(Source column 'Label' not found):
Fix
It can be fixed by setting name in ColumnAttribute
The text was updated successfully, but these errors were encountered: