Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Using training data location that is passed trough constructor this method is building
- /// and training machine learning model.
- /// </summary>
- /// <returns>Trained machine learning model.</returns>
- public PredictionModel<IrisFlower, IrisPredict> BuildAndTrain()
- {
- var pipeline = new LearningPipeline();
- pipeline.Add(new TextLoader(_trainingDataLocation).CreateFrom<IrisFlower>(useHeader: true, separator: ','));
- pipeline.Add(new Dictionarizer("Label"));
- pipeline.Add(new ColumnConcatenator("Features", "SepalLength", "SepalWidth", "PetalLength", "PetalWidth"));
- pipeline.Add(new StochasticDualCoordinateAscentClassifier());
- pipeline.Add(new PredictedLabelColumnOriginalValueConverter() { PredictedLabelColumn = "PredictedLabel" });
- return pipeline.Train<IrisFlower, IrisPredict>();
- }
Add Comment
Please, Sign In to add comment