Skip to content

Inconsistency in usage of LossFunction for AveragedPerceptron and OnlineGradientDescent #2174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abgoswam opened this issue Jan 17, 2019 · 0 comments · Fixed by #2915
Closed
Assignees
Labels
API Issues pertaining the friendly API
Milestone

Comments

@abgoswam
Copy link
Member

The Options class for AveragedPerceptron and OnlineGradientDescent have a field LossFunction which is used as a factory

public sealed class Arguments : AveragedLinearArguments
{
[Argument(ArgumentType.Multiple, HelpText = "Loss Function", ShortName = "loss", SortOrder = 50)]
public ISupportClassificationLossFactory LossFunction = new HingeLoss.Arguments();

public sealed class Arguments : AveragedLinearArguments
{
[Argument(ArgumentType.Multiple, HelpText = "Loss Function", ShortName = "loss", SortOrder = 50)]
[TGUI(Label = "Loss Function")]
public ISupportRegressionLossFactory LossFunction = new SquaredLossFactory();

Instead of using the factory pattern, they should be defined as IClassificationLoss and IRegressionLoss respectively.

That's what the public API also uses:

public static AveragedPerceptronTrainer AveragedPerceptron(
this BinaryClassificationContext.BinaryClassificationTrainers ctx,
string labelColumn = DefaultColumnNames.Label,
string featureColumn = DefaultColumnNames.Features,
string weights = null,
IClassificationLoss lossFunction = null,

Refer to test case OnlineLinearWorkout

@sfilipi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Issues pertaining the friendly API
Projects
None yet
3 participants