Learning ML.NET(1): Building Learning Machine Pipeline with LearningPipeline The

LearningPipeline class is used to define the steps required to perform the required machine learning tasks, making the machine learning process intuitive.

Create a workflow

Create a LearningPipeline instance, add steps to the pipeline via the Add method, each step inherits from the ILearningPipelineItem interface.

where the blue part is an optional step.

产生预模型

Invoke the Training method of the LearningPipeline instance, you can get the prediction model PredictionModel<TInput,TOutput> according to the loaded and processed dataset.

var pipeline = new LearningPipeline();
/加载数据      
pipeline.Add(new TextLoader <SentimentData> (dataPath, separator: ","));
//数据预处理,将文本文档集合转换为数值功能矢量
pipeline.Add(new TextFeaturizer("Features", "SentimentText"));
//选择学习算法
pipeline.Add(new FastTreeBinaryClassifier());
var model = pipeline.Train<SentimentData, SentimentPrediction>();