ML.net-列标签中第1行的值不正确 [英] ML.net - Bad value at line 1 in column label

查看:79
本文介绍了ML.net-列标签中第1行的值不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循

I am following the Iris tutorial for ML.Net, I typed out the instructions instead of copy/pasting them so I could learn the API better, but now I am getting some errors.

当我从教程中运行此行时,会抛出System.Reflection.TargetInvocationException:

When I run this line from the tutorial a System.Reflection.TargetInvocationException is thrown:

var model = pipeline.Train<IrisData, IrisPrediction>();

我在运行时遇到的控制台错误是:

The console errors I am getting during runtime are:

  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课:

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;
    }

推荐答案

看了一会儿之后,我意识到我的一列数据类型不正确.

After looking at it for a short while I realized that one of my columns had the incorrect data type.

在用于加载学习数据的类IrisData中,我为Label使用了错误的数据类型.因此,控制台消息:Bad value at line 1 in column Label.

In the class used to load the learning data, IrisData, I used the incorrect data type for Label. Hence the console message: Bad value at line 1 in column Label.

要解决此问题,我将Label字段的数据类型从float更改为string:

To fix this, I changed the data type for the Label field from float to string:

public class IrisData
{
    ...
    [ColumnName("Label")]
    public string Label;
}

这篇关于ML.net-列标签中第1行的值不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆