Skip to content

Incremental Learning\Training #678

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
MaxAkbar opened this issue Aug 14, 2018 · 2 comments
Closed

Incremental Learning\Training #678

MaxAkbar opened this issue Aug 14, 2018 · 2 comments

Comments

@MaxAkbar
Copy link

Is there a possibility of adding incremental training a model?

@Zruty0
Copy link
Contributor

Zruty0 commented Aug 14, 2018

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
Copy link
Author

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

@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants