首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ML.net中显示'predictionEngine‘

在ML.net中显示'predictionEngine‘
EN

Stack Overflow用户
提问于 2019-10-06 17:20:48
回答 2查看 178关注 0票数 2

我正在尝试在我的项目中使用ML.net。我想显示predictionEngine列的值。但我不知道该怎么做,this picture show the predictionEngine output.

有人能帮我显示这些列吗??

代码语言:javascript
复制
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;
EN

回答 2

Stack Overflow用户

发布于 2019-10-08 12:53:09

您可以将此代码添加到源代码中

代码语言:javascript
复制
 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();
票数 1
EN

Stack Overflow用户

发布于 2019-10-08 23:17:22

您可以通过循环模式将其发送到控制台:

代码语言:javascript
复制
        predEngine.OutputSchema.ToList().ForEach(v =>
        {
            Console.WriteLine(v.Name);
        });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58255863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档