Search code examples
c#.netml.net

Retrain Multiclassification ITransformer


I created a ITransformer model based on the SdcaMaximumEntropy trainer from the MulticlassClassification :

var trainingPipeline = pipeline.Append(mlContext.MulticlassClassification.Trainers.SdcaMaximumEntropy())
                    .Append(mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel"));
ITransformer trainedModel = trainingPipeline.Fit(splitTrainSet);

Now I want to retrain it with the Fit method by applying the original model parameters :

var originalModelParameters = ((MulticlassPredictionTransformer<object>)model).Model as MaximumEntropyModelParameters;
            model = mlContext.MulticlassClassification.Trainers.SdcaMaximumEntropy().Fit(newData, originalModelParameters);

But I get an error on the Fit method :

No overload for method 'Fit' takes 2 arguments

So I'm aware that the Fit method from the SdcaMaximumEntropy trainer doesn't have the required Fit method with 2 arguments, but I am wondering how can I retrain my multiclassification model without it ?


Solution

  • Unfortunately, the SdcaMaximumEntrpy trainer isn't in the list of trainers that can be retrained. Perhaps you can try LbfgsMaximumEntropyMulticlassTrainer instead?

    Hopefully, in the future, more trainers will be able to be retrained.