【问题标题】:What columns are available for the prediction/output class in ml.net哪些列可用于 ml.net 中的预测/输出类
【发布时间】:2018-08-16 18:42:25
【问题描述】:

我在 ML.net 中运行二进制分类器。输出类如下所示,它有一个“PredictedLabel”,通过反复试验,我发现“分数”和“概率”也是有效的。有效属性记录在哪里?是否有一个我可以使用的属性(在输入数据类上具有相应的名称),它允许我在输入数据上存储一个行 id,该数据将与预测一起输出?

谢谢

public class TargetData
{
    [ColumnName("PredictedLabel")]
    public bool Value { get; set; }

    public float Score { get; set; }
    public float Probability { get; set; }
}

【问题讨论】:

标签: c# machine-learning ml.net


【解决方案1】:

ML.NET 依赖 schema comprehension 将对象的字段映射到数据视图的列并返回。

您的数据视图可以包含的列没有限制。例如,您可以将示例类定义为

public class Example
{
    // Let's say your features are floats:
    public float FeatureA;
    public float FeatureB;
    // ...
    public bool Label;

    // Here's an arbitrary RowId column.
    public string RowId; 
}

RowId 列将被创建,并在整个训练过程中一直传播,并将保留在生成的模型中。 为了读回它,只需在输出类中声明具有相同名称的字段/属性:

public class TargetData
{
    [ColumnName("PredictedLabel")]
    public bool Value { get; set; }

    public float Score { get; set; }
    public float Probability { get; set; }

    public string RowId { get; set; }
}

唯一的限制是允许的类型:例如,您不能声明 GUID 字段等。schema comprehension 文档和其他链接文档精确定义了允许的类型。

【讨论】:

  • 还有这个问题的艺术:"Where are the valid properties documented?" - 这应该取决于使用的“培训师和任务”的类型?
  • 感谢您链接到架构理解文档,似乎它不在 ML.NET 的 msdn 官方文档中的任何地方!
猜你喜欢
  • 2019-05-14
  • 1970-01-01
  • 2022-10-13
  • 2021-06-27
  • 2020-09-18
  • 1970-01-01
  • 2017-08-27
  • 2019-12-20
  • 2011-11-03
相关资源
最近更新 更多