Skip to content

Incremental Learning\Training #678

Closed
@MaxAkbar

Description

@MaxAkbar

Is there a possibility of adding incremental training a model?

Activity

Zruty0

Zruty0 commented on Aug 14, 2018

@Zruty0
Contributor

It is definitely possible using the low-level API: some linear models can be 'incrementally trained' using 'initial predictor' to initialize themselves. In #653 there is a code sample (look for TrainWithInitialPredictor test).

We are working on making a high-level API that would support such a scenario: see #584 for the list of things we want to enable.

For instance, this is how currently (in my local branch) I perform incremental training:

                // Pipeline.
                var pipeline = new MyTextLoader(env, MakeSentimentTextLoaderArgs())
                    .Append(new MyTextTransform(env, MakeSentimentTextTransformArgs()));

                // Train the pipeline, prepare train set.
                var reader = pipeline.Fit(new MultiFileSource(dataPath));
                var trainData = reader.Read(new MultiFileSource(dataPath));


                // Train the first predictor.
                var trainer = new MySdca(env, new LinearClassificationTrainer.Arguments
                {
                    NumThreads = 1
                }, "Features", "Label");
                var firstPredictor = trainer.Fit(trainData);

                // Train the second predictor on the same data.
                var secondTrainer = new MyAveragedPerceptron(env, new AveragedPerceptronTrainer.Arguments(), "Features", "Label");
                var finalPredictor = secondTrainer.Train(trainData, firstPredictor.InnerModel);
MaxAkbar

MaxAkbar commented on Aug 15, 2018

@MaxAkbar
Author

Thank you this is very helpful 👍 will take a look.

ghost locked as resolved and limited conversation to collaborators on Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @MaxAkbar@Zruty0

        Issue actions

          Incremental Learning\Training · Issue #678 · dotnet/machinelearning