AutoML Experiment example fails
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
---
**Issue moved from MicrosoftDocs/feedback#3979**
- Please respond to @Elantonio.
---
_From @Elantonio on Monday, January 22, 2024 1:15:45 PM_
I'm following the example code on:
_https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/how-to-use-the-automl-api_
```
MyMLContext = new MLContext();
ColumnInferenceResults columnInference =
MyMLContext.Auto().InferColumns(TrainFilePath, labelColumnName: LabelColumnName, groupColumns: false);
TextLoader loader = MyMLContext.Data.CreateTextLoader(columnInference.TextLoaderOptions);
// Load data into IDataView
IDataView data = loader.Load(TrainFilePath);
TrainTestData trainValidationData = MyMLContext.Data.TrainTestSplit(data, testFraction: 0.2);
SweepablePipeline pipeline =
MyMLContext.Auto().Featurizer(data, columnInformation: columnInference.ColumnInformation)
.Append(MyMLContext.Auto().Regression(labelColumnName: columnInference.ColumnInformation.LabelColumnName));
AutoMLExperiment experiment = MyMLContext.Auto().CreateExperiment();
experiment
.SetPipeline(pipeline)
.SetRegressionMetric(RegressionMetric.RSquared, labelColumn: columnInference.ColumnInformation.LabelColumnName)
.SetTrainingTimeInSeconds((uint)Math.Max(seconds, 10))
.SetDataset(trainValidationData);
TrialResult experimentResults = experiment.Run();
```
But it gives an error on experiment.Run();
Error = "_One or more errors occurred. (Could not find feature column 'Features' (Parameter 'inputSchema')_"
I can't seem to find what I'm missing here.
Anyone an idea, and if so should the docu be updated?
**To reproduce**
Steps to reproduce the behavior:
-in vs2022 create a project
-Add nuget Microsoft.ML.AutoML 0.21.1
-create a class Predictor
-add an instantiator with the above code;
-Build
-Instantiate the class
**Expected behavior**
Run without error
Environment
Desktop OS: Win11 .
Visual Studio Community 2022 (64-bit) -17.6.4
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: c3bb37d9-1c4d-5d5f-2ed6-2ef77f2cd627
* Version Independent ID: 80ed0d4d-63d3-49f0-ae42-d1f132137352
* Content: [How to use the ML.NET Automated ML (AutoML) API - ML.NET](https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/how-to-use-the-automl-api)
* Content Source: [docs/machine-learning/how-to-guides/how-to-use-the-automl-api.md](https://github.com/dotnet/docs/blob/main/docs/machine-learning/how-to-guides/how-to-use-the-automl-api.md)
* Service: **dotnet-ml**
* GitHub Login: @luisquintanilla
* Microsoft Alias: **luquinta**
Contributor guide
Assessment
This issue has not been assessed yet.