| mlr_pipeops_mcboost {mcboost} | R Documentation |
Multi-Calibrate a Learner's Prediction
Description
mlr3pipelines::PipeOp that trains a Learner and passes its predictions forward during training and prediction.
Post-process a learner prediction using multi-calibration.
For more details, please refer to https://arxiv.org/pdf/1805.12317.pdf (Kim et al. 2018)
or the help for MCBoost.
If no init_predictor is provided, the preceding learner's predictions
corresponding to the prediction slot are used as an initial predictor for MCBoost.
Format
R6Class inheriting from mlr3pipelines::PipeOp.
R6Class inheriting from mlr3pipelines::PipeOp.
Construction
PipeOpLearnerPred$new(learner, id = NULL, param_vals = list()) * `learner` :: [`Learner`][mlr3::Learner] \cr [`Learner`][mlr3::Learner] to prediction, or a string identifying a [`Learner`][mlr3::Learner] in the [`mlr3::mlr_learners`] [`Dictionary`][mlr3misc::Dictionary]. * `id` :: `character(1)` Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. * `param_vals` :: named `list`\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. [mlr3::Learner]: R:mlr3::Learner [mlr3::Learner]: R:mlr3::Learner [mlr3::Learner]: R:mlr3::Learner [`mlr3::mlr_learners`]: R:%60mlr3::mlr_learners%60 [mlr3misc::Dictionary]: R:mlr3misc::Dictionary [mlr3::Learner]: R:mlr3::Learner
PipeOpMCBoost$new(id = "mcboost", param_vals = list())
-
id::character(1)Identifier of the resulting object, default"threshold". -
param_vals:: namedlist
List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. SeeMCBoostfor a comprehensive description of all hyperparameters.
Input and Output Channels
PipeOpLearnerPred has one input channel named "input", taking a Task specific to the Learner
type given to learner during construction; both during training and prediction.
PipeOpLearnerPred has one output channel named "output", producing a Task specific to the Learner
type given to learner during construction; both during training and prediction.
During training, the input and output are "data" and "prediction", two TaskClassif.
A PredictionClassif is required as input and returned as output during prediction.
State
The $state is a MCBoost Object as obtained from MCBoost$new().
Parameters
The $state is set to the $state slot of the Learner object, together with the $state elements inherited from
mlr3pipelines::PipeOpTaskPreproc. It is a named list with the inherited members, as well as:
-
model::any
Model created by theLearner's$.train()function. -
train_log::data.tablewith columnsclass(character),msg(character)
Errors logged during training. -
train_time::numeric(1)
Training time, in seconds. -
predict_log::NULL|data.tablewith columnsclass(character),msg(character)
Errors logged during prediction. -
predict_time::NULL|numeric(1)Prediction time, in seconds.
-
max_iter::integer
A integer specifying the number of multi-calibration rounds. Defaults to 5.
Fields
Fields inherited from PipeOp, as well as:
-
learner::Learner
Learnerthat is being wrapped. Read-only. -
learner_model::Learner
Learnerthat is being wrapped. This learner contains the model if thePipeOpis trained. Read-only.
Only fields inherited from mlr3pipelines::PipeOp.
Methods
Methods inherited from mlr3pipelines::PipeOpTaskPreproc/mlr3pipelines::PipeOp.
Only methods inherited from mlr3pipelines::PipeOp.
Super classes
mlr3pipelines::PipeOp -> mlr3pipelines::PipeOpTaskPreproc -> PipeOpLearnerPred
Active bindings
learnerThe wrapped learner.
learner_modelThe wrapped learner's model(s).
Methods
Public methods
Inherited methods
Method new()
Initialize a Learner Predictor PipeOp. Can be used to wrap trained or untrainted mlr3 learners.
Usage
PipeOpLearnerPred$new(learner, id = NULL, param_vals = list())
Arguments
Method clone()
The objects of this class are cloneable with this method.
Usage
PipeOpLearnerPred$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Super class
mlr3pipelines::PipeOp -> PipeOpMCBoost
Active bindings
predict_typePredict type of the PipeOp.
Methods
Public methods
Inherited methods
Method new()
Initialize a Multi-Calibration PipeOp.
Usage
PipeOpMCBoost$new(id = "mcboost", param_vals = list())
Arguments
Method clone()
The objects of this class are cloneable with this method.
Usage
PipeOpMCBoost$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
https://mlr3book.mlr-org.com/list-pipeops.html
https://mlr3book.mlr-org.com/list-pipeops.html
Examples
## Not run:
gr = gunion(list(
"data" = po("nop"),
"prediction" = po("learner_cv", lrn("classif.rpart"))
)) %>>%
PipeOpMCBoost$new()
tsk = tsk("sonar")
tid = sample(1:208, 108)
gr$train(tsk$clone()$filter(tid))
gr$predict(tsk$clone()$filter(setdiff(1:208, tid)))
## End(Not run)