Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MLNetSaveModel.cs
class Program
{
static void Main(string[] args)
{
var agesRangesCsv = "AgeRangeData.csv";
var pipeline = new LearningPipeline();
pipeline.Add(new TextLoader<AgeRangeData>(agesRangesCsv, separator: ","));
pipeline.Add(new Dictionarizer("Label"));
pipeline.Add(new ColumnConcatenator("Features", "AgeStart", "AgeEnd"));
pipeline.Add(new StochasticDualCoordinateAscentClassifier());
pipeline.Add(new PredictedLabelColumnOriginalValueConverter {PredictedLabelColumn = "PredictedLabel"});
var model = pipeline.Train<AgeRangeData, AgeRangePrediction>();
var modelFilePath = "AgeRangeDataModel.zip";
model.WriteAsync(modelFilePath);
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment