dotnet / dotnet/machinelearning

Q: How to load from CSV file to DataView based on DataViewSchema?

Open
#5,931 2 comments 0 reactions 0 assignees View on GitHub
area-Core enhancement
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

I can load from Enumerable using DataViewSchema:
```
MLContext mlContext = new MLContext();
ITransformer model = mlContext Model.Load(ModelZipPath, out DataViewSchema ModelInputSchema);
var trainingDataview = mlContext.Data.LoadFromEnumerable(inputs, ModelInputSchema);
```

If some cases, we might not have the object class available, and we want to load from a file:
` mlContext.Data.LoadFromTextFile()`

In this case, there is no overload accepting DataViewSchema. TextLoader.Options has a Columns property, but it is of type Microsoft.ML.Data.TextLoader.Column[] while DataViewSchema inherits from IEnumerable

I suppose it is possible to manually create new TextLoader.Column object from DataViewSchema, but is there a better inteded way?

If not, then perhaps TextLoader.Columns could have a .FromDataViewSchema(schema) overload.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.