This Learner specializes Learner for classification problems.

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

Format

R6::R6Class object inheriting from Learner.

Construction

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

For a description of the arguments, see Learner. task_type is set to "classif". Possible values for predict_types are a subset of c("response", "prob").

Fields

See Learner.

Methods

See Learner.

See also

Example classification learners: classif.rpart

Other Learner: LearnerRegr, Learner, mlr_learners

Examples

# get all classification learners from mlr_learners: lrns = mlr_learners$mget(mlr_learners$keys("^classif")) names(lrns)
#> [1] "classif.debug" "classif.featureless" "classif.rpart"
# get a specific learner from mlr_learners: lrn = lrn("classif.rpart") print(lrn)
#> <LearnerClassifRpart:classif.rpart> #> * Model: - #> * Parameters: xval=0 #> * Packages: rpart #> * Predict Type: response #> * Feature types: logical, integer, numeric, character, factor, ordered #> * Properties: importance, missings, multiclass, selected_features, #> twoclass, weights
# train the learner: task = tsk("iris") lrn$train(task, 1:120) # predict on new observations: lrn$predict(task, 121:150)$confusion
#> truth #> response setosa versicolor virginica #> setosa 0 0 0 #> versicolor 0 0 5 #> virginica 0 0 25