Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created October 10, 2018 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/62a4774639c6ae177a2515b7ebf1f510 to your computer and use it in GitHub Desktop.
Save elbruno/62a4774639c6ae177a2515b7ebf1f510 to your computer and use it in GitHub Desktop.
MLNet050SampleProgram.cs
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