dotnet / dotnet/machinelearning

How to append estimator after a LightGBM trainer with early stopping

Open
#3,603 13 comments 1 reaction 0 assignees View on GitHub
area-Trees enhancement Priority:2
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

Version: 0.11

When using early stopping (which is fantastic) with LightGBM you have to use:

```C#
var trainer = ctx.MulticlassClassification.Trainers.LightGbm(options);
var model = trainer.Fit(trainEncodedDv, testEncodedDv);
```

However, I need to append other estimators after the trainer. Like:

```C#
trainer = trainer.Append(ctx.Transforms.Conversion.MapKeyToValue(DefaultColumnNames.PredictedLabel))
.Append(ctx.Transforms.Conversion.MapKeyToValue((nameof(MlNetPrediction.OriginalLabelData), DefaultColumnNames.Label)));
```

Which of course I cannot do since then I cannot call the *two*-arity `fit` method anymore.

How can I solve this issue?

Btw: I think early stopping is absolutely crucial for any machine learning and IMO all iterative algorithms should support it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.