Machinelearning: there's an alternative to the TextLoader class?I would like to add the data to the pipeline without to use a file. Regards

Created on 3 Jul 2018  路  2Comments  路  Source: dotnet/machinelearning

System information

  • OS version/distro:
  • .NET Version (eg., dotnet --info):

Issue

  • What did you do?
  • What happened?
  • What did you expect?

Source code / logs

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

question

Most helpful comment

Perhaps CollectionDataSource is what you need. Here's an example from the 0.2 release blog post.

var pipeline = new LearningPipeline();
var data = new List() {
           new IrisData { SepalLength = 1f, SepalWidth = 1f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=1},
           new IrisData { SepalLength = 1f, SepalWidth = 1f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=1},
           new IrisData { SepalLength = 1.2f, SepalWidth = 0.5f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=0}
           };
var collection = CollectionDataSource.Create(data);
pipeline.Add(collection); 

Hope that helps!

All 2 comments

Perhaps CollectionDataSource is what you need. Here's an example from the 0.2 release blog post.

var pipeline = new LearningPipeline();
var data = new List() {
           new IrisData { SepalLength = 1f, SepalWidth = 1f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=1},
           new IrisData { SepalLength = 1f, SepalWidth = 1f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=1},
           new IrisData { SepalLength = 1.2f, SepalWidth = 0.5f 
                         ,PetalLength=0.3f, PetalWidth=5.1f, Label=0}
           };
var collection = CollectionDataSource.Create(data);
pipeline.Add(collection); 

Hope that helps!

Great, many thanks @jwood803

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxt3r picture maxt3r  路  3Comments

samueleresca picture samueleresca  路  3Comments

sethreidnz picture sethreidnz  路  3Comments

OneCyrus picture OneCyrus  路  4Comments

rebecca-burwei picture rebecca-burwei  路  3Comments