dotnet / dotnet/machinelearning

Schema mismatch using AutoML API

Open
#6,544 8 comments 0 reactions 1 assignee Claimed by @LittleLittleCloud View on GitHub
area-AutoML needs-further-triage
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

Windows 10
Microsoft.Ml 2.0
Micorsoft.Ml.AutoML 0.20.0

I receive this error :

System.ArgumentOutOfRangeException: 'Schema mismatch for label column 'NextDayClose': expected Single, got Boolean (Parameter 'labelCol')'

when running this code copied and pasted from the AutoML QuickStart sample:

```
// Initialize MLContext
using Microsoft.ML;
using Microsoft.ML.AutoML;
using Microsoft.ML.Data;
using static Microsoft.ML.DataOperationsCatalog;

// Initialize MLContext
MLContext ctx = new MLContext();

// Define data path
var dataPath = Path.GetFullPath(@"CSATest.csv");

// Infer column information
ColumnInferenceResults columnInference =
ctx.Auto().InferColumns(dataPath, labelColumnName: "NextDayClose", groupColumns: false);

// Create text loader
TextLoader loader = ctx.Data.CreateTextLoader(columnInference.TextLoaderOptions);

// Load data into IDataView
IDataView data = loader.Load(dataPath);

// Split into train (80%), validation (20%) sets
TrainTestData trainValidationData = ctx.Data.TrainTestSplit(data, testFraction: 0.2);

//Define pipeline
SweepablePipeline pipeline =
ctx.Auto().Featurizer(data, columnInformation: columnInference.ColumnInformation)
.Append(ctx.Auto().MultiClassification(labelColumnName: columnInference.ColumnInformation.LabelColumnName));

// Create AutoML experiment
AutoMLExperiment experiment = ctx.Auto().CreateExperiment();

// Configure experiment
experiment
.SetPipeline(pipeline)
.SetMulticlassClassificationMetric(MulticlassClassificatioMetric.MicroAccuracy, labelColumn:columnInference.ColumnInformation.LabelColumnName)
.SetTrainingTimeInSeconds(10)
.SetDataset(trainValidationData);

// Log experiment trials
ctx.Log += (_, e) => {
if (e.Source.Equals("AutoMLExperiment"))
{
Console.WriteLine(e.RawMessage);
}
};

// Run experiment
TrialResult experimentResults = await experiment.RunAsync();

// Get best model
var model = experimentResults.Model;
```
Attached is the csv file being called.

[CSATest.csv](https://github.com/dotnet/machinelearning/files/10471206/CSATest.csv)

Is there a way to override the data type that InferColumns is inferring? Looks like it's expecting a bool yet it's a single.

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.