我刚刚从ml.net开始,发现自己被基于各种api版本的api和示例的快速发展弄糊涂了。
我的目标是读入几个数字特征列和一个指定标签(“brand”)的文本列,但在这段代码的最后一行出现错误
var trainingDataView = mlContext.Data.ReadFromTextFile<PurchaseData>
(path: trainDataPath, hasHeader: true, separatorChar: ',');
var dataProcessPipeline = mlContext.Transforms
.Concatenate(DefaultColumnNames.Features,
nameof(PurchaseData.AgeBracket),
nameof(PurchaseData.Gender),
nameof(PurchaseData.IncomeBracket),
)
.Append(mlContext.Transforms.CopyColumns("Label", nameof(PurchaseData.Brand)))
.AppendCacheCheckpoint(mlContext);
var trainer = mlContext.MulticlassClassification.Trainers
.StochasticDualCoordinateAscent(featureColumn: DefaultColumnNames.Features);
var trainingPipeline = dataProcessPipeline.Append(trainer);
var trainedModel = trainingPipeline.Fit(trainingDataView);
“label列的架构不匹配”:应为float、double或keytype,get text”
为什么标签不应该/不允许是文本,我可以做些什么来修复它?