mlr_learners_classif.debug {mlr3}R Documentation

Classification Learner for Debugging

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:

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.

count_marshaling:

If TRUE, marshal_model will increase the marshal_count by 1 each time it is called. The default is FALSE.

check_pid:

If TRUE, the ⁠$predict()⁠ function will throw an error if the model was not unmarshaled in the same session that is used for prediction.)

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

Parameters

Id Type Default Levels Range
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 na, omit -
save_tasks logical FALSE TRUE, FALSE -
segfault_predict numeric 0 [0, 1]
segfault_train numeric 0 [0, 1]
sleep_train untyped - -
sleep_predict untyped - -
threads integer - [1, \infty)
warning_predict numeric 0 [0, 1]
warning_train numeric 0 [0, 1]
x numeric - [0, 1]
iter integer 1 [1, \infty)
early_stopping logical FALSE TRUE, FALSE -
count_marshaling logical FALSE TRUE, FALSE -
check_pid logical TRUE TRUE, FALSE -

Super classes

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

Active bindings

marshaled

(logical(1))
Whether the learner has been marshaled.

internal_valid_scores

Retrieves the internal validation scores as a named list(). Returns NULL if learner is not trained yet.

internal_tuned_values

Retrieves the internally tuned values as a named list(). Returns NULL if learner is not trained yet.

validate

How to construct the internal validation data. This parameter can be either NULL, a ratio in $(0, 1)$, "test", or "predefined".

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerClassifDebug$new()

Method marshal()

Marshal the learner's model.

Usage
LearnerClassifDebug$marshal(...)
Arguments
...

(any)
Additional arguments passed to marshal_model().


Method unmarshal()

Unmarshal the learner's model.

Usage
LearnerClassifDebug$unmarshal(...)
Arguments
...

(any)
Additional arguments passed to unmarshal_model().


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: 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

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)
learner$predict(task)

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

[Package mlr3 version 0.20.2 Index]