From 0f262f0358a170ad997c0c54748b75a82994bebc Mon Sep 17 00:00:00 2001 From: feiyun0112 Date: Sun, 10 Sep 2023 01:58:31 +0000 Subject: [PATCH] use HingeLoss as default loss function --- .../Standard/Online/AveragedPerceptron.cs | 2 +- src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.ML.StandardTrainers/Standard/Online/AveragedPerceptron.cs b/src/Microsoft.ML.StandardTrainers/Standard/Online/AveragedPerceptron.cs index ff08d0fb5e..8d4b9ef893 100644 --- a/src/Microsoft.ML.StandardTrainers/Standard/Online/AveragedPerceptron.cs +++ b/src/Microsoft.ML.StandardTrainers/Standard/Online/AveragedPerceptron.cs @@ -184,7 +184,7 @@ internal AveragedPerceptronTrainer(IHostEnvironment env, Options options) DecreaseLearningRate = decreaseLearningRate, L2Regularization = l2Regularization, NumberOfIterations = numberOfIterations, - LossFunction = lossFunction ?? new HingeLoss() + LossFunction = lossFunction }) { } diff --git a/src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs b/src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs index dc7be83e0e..6f6fa3e09c 100644 --- a/src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs +++ b/src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs @@ -426,7 +426,7 @@ public static class StandardTrainersCatalog Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); - return new AveragedPerceptronTrainer(env, labelColumnName, featureColumnName, lossFunction ?? new LogLoss(), learningRate, decreaseLearningRate, l2Regularization, numberOfIterations); + return new AveragedPerceptronTrainer(env, labelColumnName, featureColumnName, lossFunction, learningRate, decreaseLearningRate, l2Regularization, numberOfIterations); } ///