dotnet / dotnet/machinelearning

Re-train OneVersus all models

Open
#4,641 5 comments 0 reactions 0 assignees View on GitHub
area-Trainers enhancement Priority:2
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

### System information

- Win 10
- .NET 4.7.2

### Question
Looking at [https://docs.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/retrain-model-ml-net](https://docs.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/retrain-model-ml-net
) I see that an AveragedPercepton model can be retrained but this only seems to be when used as a binary classifier. Using it as part of a multiclass pipeline (see below) then the fit method does not support model parameters. I may be missing something but it does not appear that you can retrain binary classifiers in this scenario.

### Source code / logs
```
var dataProcessPipeline =
ctx.Transforms.Conversion.MapValueToKey("Category", "Prediction")
.Append(ctx.Transforms.Text.FeaturizeText("Description_tf", textOptions, "Features"))
.Append(ctx.Transforms.CopyColumns("Features", "Description_tf"))
.Append(ctx.Transforms.NormalizeMinMax("Features", "Features"))
.AppendCacheCheckpoint(ctx);

var trainer = ctx.MulticlassClassification.Trainers
.OneVersusAll(ctx.BinaryClassification.Trainers
.AveragedPerceptron("Category", numberOfIterations: iterations), "Category")
.Append(ctx.Transforms.Conversion.MapKeyToValue("PredictedLabel", "PredictedLabel"));

var trainingPipeline = dataProcessPipeline.Append(trainer);
return trainingPipeline.Fit(trainingDataView);
```

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.