Det*_*ium 7 .net c# machine-learning ml.net
我正在尝试使用一些随机测试数据的ML.net框架.我的数据存在DepartmentId(1-25)和Body(字符串).我希望我的机器预测应该分配正文的部门(例如在像Zendesk这样的票务系统中).
使用以下代码,我收到一个错误:
ArgumentOutOfRangeException:缺少分数列
我不确定为什么它会说Score
列缺失,因为它出现在我的预测课程中.
这是我训练模型以及课程的设置.
主要
var pipeline = new LearningPipeline();
pipeline.Add(new TextLoader(_dataPath).CreateFrom<DepartmentData>(userHeader: true, seperator: ','));
pipeline.Add(new TextFeaturizer("Features", "Body"));
pipeline.Add(new Dictionarizer("Label"));
pipeline.Add(new StochasticDualCoordinateAscentClassifier());
pipeline.Add(new PredictedLabelColumnOriginalValueConverter() { PredictedLabelColumn = "PredictedLabel" });
var model = pipeline.Train<DepartmentData, DepartmentPrediction>();
Run Code Online (Sandbox Code Playgroud)
DepartmentData和DepartmentPrediction
public class DepartmentData
{
[Column(ordinal: "0", name: "Label")]
public float Department;
[Column(ordinal: "1")]
public string Body;
}
public class DepartmentPrediction
{
[ColumnName("PredictedLabel")]
public float Department;
[ColumnName("Score")]
public float[] Score;
}
Run Code Online (Sandbox Code Playgroud)
示例数据
Department, Body
1, Hello. 4 weeks ago I requested a replacement keycap for my keyboard. I still ahvent received the keycap. Perhaps you can confirm that it has been shipped?
13, I seem to have some problems when paying for you new mouse XZ-250 I'm being told that my card is not valid?
1, I just received the package I bought from you but I'm most definetly not satisfied with the shipment. The box was bended and broken when it received as well as the GPU inside. I demand that you ship a new one to me without charge. I've attached a few images of the box and the GPU here.
/* etc... */
Run Code Online (Sandbox Code Playgroud)
评估
var testData = new TextLoader(_testDataPath).CreateFrom<DepartmentData>(useHeader: true, seperator: ',');
var evaluator = new ClassificationEvaluator();
var metrics = evaluator.Evaluate(model, testData);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
734 次 |
最近记录: |