Skip to content

OnlineGradientDescent crash #4363

Closed
Closed
@daholste

Description

@daholste

System information

  • OS version/distro: Windows 10
  • .NET Version (eg., dotnet --info): .NET Core 2.2

Issue

  • What did you do?
    I ran the script:
var mlContext = new MLContext();
var textLoader = mlContext.Data.CreateTextLoader(new TextLoader.Options()
{
	Columns = new TextLoader.Column[]
	{
		new TextLoader.Column("Label", DataKind.Single, 0),
		new TextLoader.Column("0", DataKind.String, 1),
		new TextLoader.Column("1", DataKind.String, 2),
		new TextLoader.Column("2", DataKind.Single, 3),
		new TextLoader.Column("3", DataKind.Single, 4),
		new TextLoader.Column("4", DataKind.Single, 5),
		new TextLoader.Column("5", DataKind.Single, 5),
	},
	HasHeader = true,
	Separators = new char[] {','}
});
var dataView = textLoader.Load(@"dataset.csv");
var pipeline = mlContext.Transforms.Categorical.OneHotHashEncoding("0")
	.Append(mlContext.Transforms.Categorical.OneHotEncoding("1", "3"))
	.Append(mlContext.Transforms.Concatenate("Features", "0", "1", "2", "3", "4", "5"))
	.Append(mlContext.Transforms.NormalizeMinMax("Features"))
	.Append(mlContext.Regression.Trainers.OnlineGradientDescent(new OnlineGradientDescentTrainer.Options()
	{
		LearningRate = 1.0f,
		DecreaseLearningRate = false,
	}));
pipeline.Fit(dataView);

(I can provide the data as requested)

  • What happened?
    I get the exception
System.InvalidOperationException
  HResult=0x80131509
  Message=The weights/bias contain invalid values (NaN or Infinite). Potential causes: high learning rates, no normalization, high initial weights, etc.
  Source=Microsoft.ML.StandardTrainers
  StackTrace:
   at Microsoft.ML.Trainers.OnlineLinearTrainer`2.TrainModelCore(TrainContext context)
   at Microsoft.ML.Trainers.TrainerEstimatorBase`2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor)
   at Microsoft.ML.Data.EstimatorChain`1.Fit(IDataView input)
   at OnlineGradientDescentCrash.Program.Main(String[] args) in C:\Users\daholste\source\repos\OnlineGradientDescentCrash\OnlineGradientDescentCrash\Program.cs:line 38
  • What did you expect?
    Successful training

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions