ML.net - 列标签中第 1 行的错误值
ML.net - Bad value at line 1 in column label
我正在按照 ML.Net 的 Iris tutorial,我输入了说明而不是 copy/pasting,这样我可以更好地学习 API,但现在我得到一些错误。
当我 运行 教程中的这一行 System.Reflection.TargetInvocationException
被抛出:
var model = pipeline.Train<IrisData, IrisPrediction>();
我在 运行 期间遇到的控制台错误是:
Bad value at line 2 in column Label
...
Bad value at line 8 in column Label
Suppressing further bad value messages
...
Processed 150 rows with 150 bad values and 0 format errors
Warning: Term map for output column 'Label' contains no entries.
Automatically adding a MinMax normalization transform, use 'norm=Warn' or 'norm=No' to turn this behavior off.
Using 2 threads to train.
Automatically choosing a check frequency of 2.
Bad value at line 1 in column Label
...
Suppressing further bad value messages
Processed 150 rows with 150 bad values and 0 format errors
Warning: Skipped 150 instances with missing features/label during training
这是我的 IrisData
class:
namespace Ronald.A.Fisher
{
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 float Label;
}
看了一会儿后,我意识到我的其中一个列的数据类型不正确。
在用于加载学习数据的class中,IrisData
,我为Label
使用了不正确的数据类型。因此控制台消息:Bad value at line 1 in column Label
.
为了解决这个问题,我将 Label
字段的数据类型从 float
更改为 string
:
public class IrisData
{
...
[ColumnName("Label")]
public string Label;
}
我正在按照 ML.Net 的 Iris tutorial,我输入了说明而不是 copy/pasting,这样我可以更好地学习 API,但现在我得到一些错误。
当我 运行 教程中的这一行 System.Reflection.TargetInvocationException
被抛出:
var model = pipeline.Train<IrisData, IrisPrediction>();
我在 运行 期间遇到的控制台错误是:
Bad value at line 2 in column Label
...
Bad value at line 8 in column Label
Suppressing further bad value messages
...
Processed 150 rows with 150 bad values and 0 format errors
Warning: Term map for output column 'Label' contains no entries.
Automatically adding a MinMax normalization transform, use 'norm=Warn' or 'norm=No' to turn this behavior off.
Using 2 threads to train.
Automatically choosing a check frequency of 2.
Bad value at line 1 in column Label
...
Suppressing further bad value messages
Processed 150 rows with 150 bad values and 0 format errors
Warning: Skipped 150 instances with missing features/label during training
这是我的 IrisData
class:
namespace Ronald.A.Fisher
{
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 float Label;
}
看了一会儿后,我意识到我的其中一个列的数据类型不正确。
在用于加载学习数据的class中,IrisData
,我为Label
使用了不正确的数据类型。因此控制台消息:Bad value at line 1 in column Label
.
为了解决这个问题,我将 Label
字段的数据类型从 float
更改为 string
:
public class IrisData
{
...
[ColumnName("Label")]
public string Label;
}