Skip to contents

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:

error_predict:

Probability to raise an exception during predict.

error_train:

Probability to raises an exception during train.

message_predict:

Probability to output a message during predict.

message_train:

Probability to output a message during train.

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.

segfault_predict:

Probability to provokes a segfault during predict.

segfault_train:

Probability to provokes a segfault during train.

sleep_train:

Function returning a single number determining how many seconds to sleep during $train().

sleep_predict:

Function returning a single number determining how many seconds to sleep during $predict().

threads:

Number of threads to use. Has no effect.

warning_predict:

Probability to signal a warning during predict.

warning_train:

Probability to signal a warning during train.

x:

Numeric tuning parameter. Has no effect.

iter:

Integer parameter for testing hotstarting.

Note that segfaults may not be triggered reliably 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():

mlr_learners$get("classif.debug")
lrn("classif.debug")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “logical”, “integer”, “numeric”, “character”, “factor”, “ordered”

  • Required Packages: mlr3

Parameters

IdTypeDefaultLevelsRange
error_predictnumeric0\([0, 1]\)
error_trainnumeric0\([0, 1]\)
message_predictnumeric0\([0, 1]\)
message_trainnumeric0\([0, 1]\)
predict_missingnumeric0\([0, 1]\)
predict_missing_typecharacternana, omit-
save_taskslogicalFALSETRUE, FALSE-
segfault_predictnumeric0\([0, 1]\)
segfault_trainnumeric0\([0, 1]\)
sleep_trainuntyped--
sleep_predictuntyped--
threadsinteger-\([1, \infty)\)
warning_predictnumeric0\([0, 1]\)
warning_trainnumeric0\([0, 1]\)
xnumeric-\([0, 1]\)
iterinteger1\([1, \infty)\)

See also

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

Super classes

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

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


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.

Examples

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)
#> Message from classif.debug->train()
learner$predict(task)
#> <PredictionClassif> for 344 observations:
#>     row_ids     truth response
#>           1    Adelie   Gentoo
#>           2    Adelie   Gentoo
#>           3    Adelie   Gentoo
#> ---                           
#>         342 Chinstrap   Gentoo
#>         343 Chinstrap   Gentoo
#>         344 Chinstrap   Gentoo

# task_train and task_predict are the input tasks for train() and predict()
names(learner$model)
#> [1] "response"     "pid"          "iter"         "id"           "task_train"  
#> [6] "task_predict"