打开: visual studio 2019 下载机器学习模块
在 工具->选项->环境-> 新特性中选用 ML
在解决方案管理器中, 添加ML项目.
选择使用场景,进行数据分析 scenario.
提供相关数据集, 并开始训练
对模型进行评分evaluation
建立耗损模型
Consume
using System; using MyMLAppML.Model; namespace myMLApp { class Program { static void Main(string[] args) { // Add input data var input = new ModelInput() { Col0 = "This restaurant was wonderful." }; // Load model and predict output of sample data ModelOutput result = ConsumeModel.Predict(input); // If Prediction is 1, sentiment is "Positive"; otherwise, sentiment is "Negative" string sentiment = result.Prediction == "1" ? "Positive" : "Negative"; Console.WriteLine($"Text: {input.Col0}\nSentiment: {sentiment}"); } } }
机器学习样例:https://github.com/dotnet/machinelearning-samples