This class stores learners for hot starting training, i.e. resuming or continuing from an already fitted model. We assume that hot starting is only possible if a single hyperparameter (also called the fidelity parameter, usually controlling the complexity or expensiveness) is altered and all other hyperparameters are identical.
The 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.
For example, if you want to train a random forest learner with 1000 trees but already have a random forest learner with 500 trees (hot start learner), you can add the hot start learner to the HotstartStack of the expensive learner with 1000 trees. If you now call the train() method (or resample() or benchmark()), a random forest with 500 trees will be fitted and combined with the 500 trees of the hotstart learner, effectively saving you to fit 500 trees.
Hot starting is only supported by learners which have the property "hotstart_forward" or "hotstart_backward". For example, an xgboost model (in list("mlr3learners")) 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.
Examples
# train learner on pima tasktask = tsk("pima")learner = lrn("classif.debug", iter =1)learner$train(task)# initialize stack with previously fitted learnerhot = HotstartStack$new(list(learner))# retrieve learner with increased fidelity parameterlearner = lrn("classif.debug", iter =2)# calculate cost of hot startinghot$start_cost(learner, task$hash)# add stack with hot start learnerlearner$hotstart_stack = hot
# train automatically uses hot start learner while fitting the modellearner$train(task)
Public fields
stack: data.table::data.table()
Stores hot start learners.
hotstart_threshold: (named numeric(1))
Threshold for storing learners in the stack. If the value of the hotstart parameter is below this threshold, the learner is not added to the stack.