c# - 在 ML.net 中显示“predictionEngine”
问题描述
我正在尝试在我的项目中使用 ML.net。我想显示 predictionEngine 列的值。但我不知道该怎么做, 这张图片显示了预测引擎的输出。
谁能帮我显示这些列??
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;
解决方案
您可以将其添加到您的源代码中
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();
推荐阅读
- java - 部署所有应用程序后启动 Tomcat 的 HTTP/HTTPS 连接器
- cloudinary - How to skip Cloudinary popup for Uploading while using Cloudinary UI widget
- angular - 在 Angular 中使用 HttpClient 会导致错误:“[object Object]”
- angularjs - 构建一个可以插入任何网络应用程序的聊天应用程序
- html - 如何对齐输入而不使文本居中
- keras - 使用自定义损失函数加载模型:ValueError:keras 中的“未知损失函数”
- python - Tensorflow - 使用 tf.contrib.layers.conv2d 时,我可以设置权重和偏差的名称吗?
- java - javax.mail.AuthenticationFailedException: 535 5.7.3 在具有 NTLM 的 Exchange Server 上身份验证不成功
- angular - 打字稿中带有承诺的角度调用函数
- xcode - Android Studio 无法运行 Xcode 模拟器