Created
June 19, 2018 00:22
-
-
Save elbruno/aa4bdb32bcf1cb1d51f30bc771c4305d to your computer and use it in GitHub Desktop.
MLNetLoadFromList.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(); | |
// 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