CPOLearner {mlrCPO}R Documentation

CPO Learner Object

Description

CPO Learners are created when a CPO gets attached to an mlr-Learner object. The resulting learner performs the operation described by the attached CPO before fitting the model specified by the Learner. It is possible to attach compound CPOs, and it is possible to attach more CPOs to a learner that is already a CPOLearner. If the attached CPO exports hyperparameters, these become part of the newly created learner and can be queried and set using functions such as getParamSet, getHyperPars, and setHyperPars.

The model created when training a CPOLearner also contains the relevant CPORetrafo information to be applied to prediction data; this can be retrieved using retrafo. The CPOInverter functionality is handled equally transparently by the model.

A CPOLearner can possibly have different LearnerProperties than the base Learner to which it is attached. This depends on the CPO's properties, see CPOProperties.

It is possible to retrieve the CPOLearner's base learner using getLearnerBare, and to get the attached CPOs using getLearnerCPO.

See Also

Other CPO lifecycle related: CPOConstructor, CPOTrained, CPO, NULLCPO, %>>%(), attachCPO(), composeCPO(), getCPOClass(), getCPOConstructor(), getCPOTrainedCPO(), identicalCPO(), makeCPO()

Other CPOLearner related: attachCPO(), getLearnerBare(), getLearnerCPO()

Examples

lrn = makeLearner("classif.logreg")
cpolrn = cpoScale() %>>% lrn
print(cpolrn)

getLearnerBare(cpolrn)  # classif.logreg Learner
getLearnerCPO(cpolrn)  # cpoScale() CPO

getParamSet(cpolrn)  # includes cpoScale hyperparameters

model = train(cpolrn, pid.task)  # behaves like a learner
retrafo(model)  # the CPORetrafo that was trained

predict(model, pid.task)  # otherwise behaves like an mlr model


[Package mlrCPO version 0.3.7-7 Index]