Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created June 19, 2018 00:22
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/aa4bdb32bcf1cb1d51f30bc771c4305d to your computer and use it in GitHub Desktop.
Save elbruno/aa4bdb32bcf1cb1d51f30bc771c4305d to your computer and use it in GitHub Desktop.
MLNetLoadFromList.cs
static void Main(string[] args)
{
var fileName = "AgeRanges.csv";
var pipeline = new LearningPipeline();
// standard load from file
pipeline.Add(new TextLoader(fileName).CreateFrom<AgeRange>(separator: ',', useHeader: true));
// load data from List<>()
var data = new List<AgeRange>
{
new AgeRange { Name = "John", Age = 12, Sex = "M", Label = "boy"},
new AgeRange { Name = "Laslo", Age = 2, Sex = "M", Label = "baby"},
new AgeRange { Name = "Mary", Age = 16, Sex = "F", Label = "teenager"},
new AgeRange { Name = "Gracie", Age = 6, Sex = "F", Label = "girl"}
};
var collection = CollectionDataSource.Create(data);
pipeline.Add(collection);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment