我正在尝试在我的项目中使用ML.net。我想显示predictionEngine列的值。但我不知道该怎么做,this picture show the predictionEngine output.
有人能帮我显示这些列吗??
MLContext mlContext = new MLContext();
// Training code used by ML.NET CLI and AutoML to generate the model
ModelBuilder.CreateModel();
//Load the saved model into your application
ITransformer mlModel = mlContext.Model.Load(GetAbsolutePath(MODEL_FILEPATH), out DataViewSchema inputSchema);
var predEngine = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);
//Use the PredictionEngine to predict the Algorithm ModelInput label
// Try a single prediction
ModelOutput predictionResult = predEngine.Predict(Input);
return predictionResult;发布于 2019-10-08 12:53:09
您可以将此代码添加到源代码中
Console.WriteLine("Using model to make single prediction -- Comparing actual Spam with predicted Spam from sample data...\n\n");
Console.WriteLine($"Message: {sampleData.Message}");
Console.WriteLine($"\n\nActual Spam: {sampleData.Spam} \nPredicted Spam: {predictionResult.Prediction}\n\n");
Console.WriteLine("=============== End of process, hit any key to finish ===============");
Console.ReadKey();发布于 2019-10-08 23:17:22
您可以通过循环模式将其发送到控制台:
predEngine.OutputSchema.ToList().ForEach(v =>
{
Console.WriteLine(v.Name);
});https://stackoverflow.com/questions/58255863
复制相似问题