mlr3 icon indicating copy to clipboard operation
mlr3 copied to clipboard

implement hotstart for learners

Open be-marc opened this issue 3 years ago • 4 comments

Proposal

When hotstarting, a learner reuses a previously fitted model while training e.g. adding trees to a random forest.

HotstartStack stores trained learners which can be potentially used to hot start a learner. Learner automatically hot start while training if a stack is attached to the $hotstart_stack field and the stack contains a suitable learner.

resample() and benchmark() make use of hotstarting. This allows to easily use hotstarting in mlr3tuning. Grid search is sorted by hotstart parameter and hyperband directly supports it.

Hot starting is only supported by learners which have the property "hotstart_forward" or "hotstart_backward". For example, an xgboost model can hot start forward by adding more boosting iterations and a random forest can go backwards by removing trees. The fidelity parameters are tagged with "hotstart" in learner's parameter set.

be-marc avatar Oct 13 '21 20:10 be-marc

I found HotstartStack class in mlr3 and LearnerClassifXgboost$private_methods$.hotstart() method in mlr3learners after my unsuccessful attempts to implement early stopping. Is it possible to use such functionality during model tuning, i.e. in tuner$optimize()? It would be extremely convenient to train xgboost models with 100, 200, 300, ... 1000 trees by building 1000 trees in total instead of building 100+200+300+...+1000 trees.

statist-bhfz avatar Nov 13 '21 18:11 statist-bhfz

@be-marc has a quite sophisticated take on this since some weeks - maybe he can share the current status so that you could build upon this or even contribute?

pat-s avatar Nov 14 '21 16:11 pat-s

Yes but we are not quite there yet. You can install the mlr3tuning development version from GitHub and use TunerGridSearch with hotstarting. The grid is sorted by the hotstart parameter and the models are hotstarted from previously fitted models. You can also use TunerHyperband from mlr3hyperband which discards low performing hyperparameter configurations and hotstarts the promising configurations.

be-marc avatar Nov 14 '21 18:11 be-marc

@be-marc can we close here?

mllg avatar Jan 11 '22 08:01 mllg