mlr_learners_classif.debug: Classification Learner for Debugging

Description Dictionary Meta Information Parameters Super classes Methods See Also Examples

Description

A simple LearnerClassif used primarily in the unit tests and for debugging purposes. If no hyperparameter is set, it simply constantly predicts a randomly selected label. The following hyperparameters trigger the following actions:

message_train:

Probability to output a message during train.

message_predict:

Probability to output a message during predict.

warning_train:

Probability to signal a warning during train.

warning_predict:

Probability to signal a warning during predict.

error_train:

Probability to raises an exception during train.

error_predict:

Probability to raise an exception during predict.

segfault_train:

Probability to provokes a segfault during train.

segfault_predict:

Probability to provokes a segfault during predict.

predict_missing

Ratio of predictions which will be NA.

predict_missing_type

To to encode missingness. “na” will insert NA values, “omit” will just return fewer predictions than requested.

save_tasks:

Saves input task in model slot during training and prediction.

threads:

Number of threads to use. Has no effect.

x:

Numeric tuning parameter. Has no effect.

Note that segfaults may not be triggered on your operating system. Also note that if they work as intended, they will tear down your R session immediately!

Dictionary

This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn():

1
2
mlr_learners$get("classif.featureless")
lrn("classif.featureless")

Meta Information

Parameters

Id Type Default Range Levels
error_predict numeric 0 [0, 1] -
error_train numeric 0 [0, 1] -
message_predict numeric 0 [0, 1] -
message_train numeric 0 [0, 1] -
predict_missing numeric 0 [0, 1] -
predict_missing_type character na (-Inf, Inf) na, omit
save_tasks logical FALSE (-Inf, Inf) TRUE, FALSE
segfault_predict numeric 0 [0, 1] -
segfault_train numeric 0 [0, 1] -
threads integer - [1, Inf) -
warning_predict numeric 0 [0, 1] -
warning_train numeric 0 [0, 1] -
x numeric - [0, 1] -

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifDebug

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerClassifDebug$new()

Method clone()

The objects of this class are cloneable with this method.

Usage
LearnerClassifDebug$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Learner: LearnerClassif, LearnerRegr, Learner, mlr_learners_classif.featureless, mlr_learners_classif.rpart, mlr_learners_regr.featureless, mlr_learners_regr.rpart, mlr_learners

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
learner = lrn("classif.debug")
learner$param_set$values = list(message_train = 1, save_tasks = TRUE)

# this should signal a message
task = tsk("penguins")
learner$train(task)
learner$predict(task)

# task_train and task_predict are the input tasks for train() and predict()
names(learner$model)

mlr3 documentation built on Aug. 6, 2021, 1:07 a.m.