Created
October 10, 2018 20:42
-
-
Save elbruno/62a4774639c6ae177a2515b7ebf1f510 to your computer and use it in GitHub Desktop.
MLNet050SampleProgram.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var fileName = "AgeRanges.csv"; | |
var pipeline = new LearningPipeline(); | |
pipeline.Add(new TextLoader(fileName).CreateFrom<AgeRange>(separator: ',', useHeader: true)); | |
pipeline.Add(new Dictionarizer("Label")); | |
pipeline.Add(new ColumnConcatenator("Features", "Age")); | |
pipeline.Add(new StochasticDualCoordinateAscentClassifier()); | |
pipeline.Add(new PredictedLabelColumnOriginalValueConverter {PredictedLabelColumn = "PredictedLabel" }); | |
var model = pipeline.Train<AgeRange, AgeRangePrediction>(); | |
Predict(model, "john", 9, "M"); | |
Predict(model, "mary", 14, "M"); | |
Predict(model, "laura", 2, "M"); | |
Console.ReadLine(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment