ml.net 中的 prediction/output class 有哪些列可用

What columns are available for the prediction/output class in ml.net

我是 运行 二进制 class ML.net 中的化身。输出 class 如下所示,它有一个 "PredictedLabel" 并且通过反复试验我发现 "score" 和 "probability" 也是有效的。有效属性记录在哪里?是否有我可以使用的 属性(在输入数据上有相应的名称 class),它允许我在将与预测一起输出的输入数据上存储行 ID?

谢谢

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

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

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

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

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 列,并在整个训练过程中一直传播,并将保留在生成的模型中。 为了读回它,只需在输出 class:

中声明具有相同名称的 field/property
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 文档和其他链接文档精确定义了允许的类型。