Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

AutoML Experiment example fails #3979

Closed
Elantonio opened this issue Jan 22, 2024 · 2 comments
Closed

AutoML Experiment example fails #3979

Elantonio opened this issue Jan 22, 2024 · 2 comments
Labels
bug Something isn't working Pri3

Comments

@Elantonio
Copy link

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

@Elantonio Elantonio added the bug Something isn't working label Jan 22, 2024
Copy link

welcome bot commented Jan 22, 2024

Thank you for opening an issue! One of our team members will get back to you with additional information.

If this is a product issue, please close this issue and contact the product's support instead. For a list of support websites, see Support for Microsoft products and apps.

@gewarren
Copy link
Member

This issue was moved to dotnet/docs#39298

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Pri3
Projects
None yet
Development

No branches or pull requests

2 participants