machinelearning: NullReferenceException when trying to run AutoML regression experiment from code

System Information (please complete the following information):

  • OS & Version: Microsoft Windows 10 Pro 10.0.19045 N/A Build 19045
  • ML.NET Version: 2.0.1
  • microsoft.ml.automl: 0.20.1
  • .NET Version: .NET 6.0

Describe the bug When trying to run AutoML regression experiment on a table with data of 30 rows in QuestDB (implements Postgresql) the following exception occurs:

	Message	"`Object reference not set to an instance of an object.`"	string
	Source	"`Microsoft.ML.AutoML`"	string
	StackTrace	" `  at Microsoft.ML.AutoML.AutoMLExperiment.<RunAsync>d__26.MoveNext()`"	string
	TargetSite	`{Void MoveNext()}	System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}`
	DeclaringType	{Name = "`<RunAsync>d__26" FullName = "Microsoft.ML.AutoML.AutoMLExperiment+<RunAsync>d__26`"}	System.Type {System.RuntimeType}

To Reproduce Download QuestDB Create table "CREATE TABLE 'tests' (Ticker SYMBOL, H FLOAT, P_T FLOAT,timestamp TIMESTAMP) timestamp (timestamp) PARTITION BY MONTH;" Insert 30 rows to the table IN C#: get the table data into IDataView with mlContext.Data.CreateDatabaseLoader and using Npgsql; run the following code: ExperimentResult<RegressionMetrics> experimentResult = mlContext.Auto().CreateRegressionExperiment(20).Execute(dataview, "P_T"); Expected behavior The code should not throw an Exception and finish the experiment. This code works perfectly on a large table with 28000 rows and 30 columns

Additional context I Tried running the experiment from the modelbuilder on csv and it works.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@superichmann Thanks, I’m able to reproduce the error and locate bug now. We’ll push a fix really quickly.

As a workaround, you can either use cross-validation or explicilty set validation dataset

var trainTestSplit = context.Data.TrainTestSplit(train , 0.2);

...
var result = context.Auto()
    .CreateRegressionExperiment(settings)
    .Execute(trainTestSplit.Trainset, trainTestSplit.Testset, label);

Sorry for the trouble and let me know if that workaround works for you