第一次学习如何使用 ML.NET,想尝试在数据库上进行异常检测。我获取了以下数据:
public string Title { get; set; } public string CertValidFrom { get; set; } public string CertValidTo { get; set; } public float Label { get; set; }
Label 是随机化主成分分析训练器所需的,并且被设置为 0。我还对文本进行了特征化处理:
IEstimator<ITransformer> dataProcessPipeline = mLContext.Transforms .Text.FeaturizeText("TitleF", "Title") .Append(mLContext.Transforms.Text.FeaturizeText("CertValidFromF", "CertValidFrom")) .Append(mLContext.Transforms.Text.FeaturizeText("CertValidToF", "CertValidTo")) .Append(mLContext.Transforms.Concatenate("Features", "TitleF", "CertValidFromF", "CertValidToF"));
然后我使用了以下选项:
var options = new RandomizedPcaTrainer.Options { FeatureColumnName = "Features", ExampleWeightColumnName = null, Rank = 28, Oversampling = 20, EnsureZeroMean = true, Seed = 1};
但是在用测试数据评估模型时,我得到了以下错误:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Microsoft.ML.Core.dll: 'AUC is not defined when there is no positive class in the data'
我没有太多经验,所以我的问题是:
- 这个错误是什么意思?
- 数据处理管道是否正确?它做了什么?
回答:
简而言之,这个算法不适合我的数据集,所以我尝试了一些不同的算法。请注意,始终要研究您选择的算法的使用案例。