dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
8.94k stars 1.86k forks source link

AveragedPerceptron factory method uses wrong default loss function #6815

Open KirillShlenskiy opened 10 months ago

KirillShlenskiy commented 10 months ago

System Information:

Describe the bug StandardTrainersCatalog.AveragedPerceptron factory method uses LogLoss as its default loss function, which contradicts method documentation and AveragedPerceptronTrainer.Options defaults.

AveragedPerceptron method summary states:

<param name="lossFunction">The loss function minimized in the training process. If null, HingeLoss would be used and lead to a max-margin averaged perceptron trainer.</param>

This results in the following inconsistency in behaviour:

// Uses LogLoss:
MLContext.BinaryClassification.Trainers.AveragedPerceptron("Label");

// Uses HingeLoss:
MLContext.BinaryClassification.Trainers.AveragedPerceptron(new AveragedPerceptronTrainer.Options { LabelColumnName = "Label" });

Expected behavior 2 options: