LearnerClassifDebug: Classification Learner for Debugging

Description Format Construction 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:

Outputs a message during train if the parameter value exceeds runif(1).

message_predict:

Outputs a message during predict if the parameter value exceeds runif(1).

warning_train:

Signals a warning during train if the parameter value exceeds runif(1).

warning_predict:

Signals a warning during predict if the parameter value exceeds runif(1).

error_train:

Raises an exception during train if the parameter value exceeds runif(1).

error_predict:

Raises an exception during predict if the parameter value exceeds runif(1).

segfault_train:

Provokes a segfault during train if the parameter value exceeds runif(1).

segfault_predict:

Provokes a segfault during predict if the parameter value exceeds runif(1).

predict_missing

Ratio of predictions which will be NA.

save_tasks:

Saves input task in model slot during training and prediction.

x:

Numeric parameter. Has no effect.

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

Format

R6::R6Class inheriting from LearnerClassif.

Construction

1
2
3
LearnerClassifDebug$new()
mlr_learners$get("classif.debug")
lrn("classif.debug")

See Also

Dictionary of Learners: 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("iris")
learner$train(task)
learner$predict(task)

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

mllg/mlr3 documentation built on Sept. 27, 2019, 9:38 a.m.