mlr3 (version 0.1.4)

LearnerClassif: Classification Learner

Description

This Learner specializes Learner for classification problems.

Many predefined learners can be found in the mlr3misc::Dictionary mlr_learners after loading the mlr3learners package.

Arguments

Format

R6::R6Class object inheriting from Learner.

Construction

l = LearnerClassif$new(id, param_set = ParamSet$new(), predict_types = character(), feature_types = character(),
    properties = character(), data_formats = "data.table", packages = character(), man = NA_character_)

For a description of the arguments, see Learner. task_type is set to "classif".

Possible values for predict_types are passed to and converted by PredictionClassif:

  • "response": Predicts a class label for each observation in the test set.

  • "prob": Predicts the posterior probability for each class for each observation in the test set.

Additional learner properties include:

  • "twoclass": The learner works on binary classification problems.

  • "multiclass": The learner works on multiclass classification problems.

Fields

See Learner.

Methods

See Learner.

See Also

Example classification learners: classif.rpart

Other Learner: LearnerRegr, Learner, mlr_learners

Examples

Run this code
# NOT RUN {
# get all classification learners from mlr_learners:
lrns = mlr_learners$mget(mlr_learners$keys("^classif"))
names(lrns)

# get a specific learner from mlr_learners:
lrn = lrn("classif.rpart")
print(lrn)

# train the learner:
task = tsk("iris")
lrn$train(task, 1:120)

# predict on new observations:
lrn$predict(task, 121:150)$confusion
# }

Run the code above in your browser using DataLab