Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoML Experiment example fails #39298

Open
gewarren opened this issue Jan 29, 2024 · 1 comment
Open

AutoML Experiment example fails #39298

gewarren opened this issue Jan 29, 2024 · 1 comment
Labels
⌚ Not Triaged Not triaged

Comments

@gewarren
Copy link
Contributor

gewarren commented Jan 29, 2024


Issue moved from MicrosoftDocs/feedback#3979


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.

@gewarren
Copy link
Contributor Author


Issue moved from MicrosoftDocs/feedback#3979


From @WELCOME[bot] on Monday, January 22, 2024 1:15:48 PM

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

3 participants