dotnet / dotnet/machinelearning

Executing experiment with SamplingKeyColumnName throws 'Validation data has 0 rows Arg_ParamName_Name'

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

Description

**System Information (please complete the following information):**
- OS & Version: Windows 10
- ML.NET Version: 1.6.0
- .NET Version: .NET 5.0

**Describe the bug**
I have a dataset with a sampling key column with about 10 text values derived from week numbers. First, I infer column types
`ColumnInferenceResults columnInference = mlContext.Auto().InferColumns(TrainDataPath, LabelColumnName, groupColumns: false); `

Then, I set SamplingKeyColumnName, and run the experiment. Label and SamplingKeyColumnName are unrelated.

```
columnInformation.SamplingKeyColumnName = SamplingColumnName;
var experimentResult = experiment.Execute(TrainDataView, columnInformation, null, progressHandler);
```

After execution start I receive the exception 'Validation data has 0 rows Arg_ParamName_Name'

```
Unhandled exception. System.ArgumentException: Validation data has 0 rows (Parameter 'validationData')
at Microsoft.ML.AutoML.UserInputValidationUtil.ValidateValidationData(IDataView trainData, IDataView validationData)
at Microsoft.ML.AutoML.UserInputValidationUtil.ValidateExperimentExecuteArgs(IDataView trainData, ColumnInformation columnInformation, IDataView validationData, TaskKind task)
at Microsoft.ML.AutoML.ExperimentBase`2.ExecuteTrainValidate(IDataView trainData, ColumnInformation columnInfo, IDataView validationData, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
at Microsoft.ML.AutoML.ExperimentBase`2.Execute(IDataView trainData, IDataView validationData, ColumnInformation columnInformation, IEstimator`1 preFeaturizer, IProgress`1 progressHandler)
at Kwork.AI.AutoML.Program.RunAutoMLExperiment(MLContext mlContext, ColumnInferenceResults columnInference) in Q:\git\Kwork.AI.AutoML\Kwork.AI.AutoML\Program.cs:line 242
at Kwork.AI.AutoML.Program.Main(String[] args) in Q:\git\Kwork.AI.AutoML\Kwork.AI.AutoML\Program.cs:line 80
```

If I don't set the sampling key, I am able to run the experiments.

I also receive the same error when trying to split manually:
```
var splitData = mlContext.Data.TrainTestSplit(TrainDataView, samplingKeyColumnName: SamplingColumnName);
experimentResult = experiment.Execute(splitData.TrainSet, splitData.TestSet, columnInformation, null, progressHandler);
```

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.