This Learner specializes Learner for classification problems. The slot task_type is set to "classif". Predefined learners can be found in the Dictionary mlr_learners.


R6::R6Class object inheriting from Learner.


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())
  • id :: character(1)
    Identifier for the learner.

  • param_set :: paradox::ParamSet
    Set of hyperparameters.

  • param_vals :: named list()
    List of hyperparameter settings.

  • predict_types :: character()
    Supported predict types. Must be a subset of mlr_reflections$learner_predict_types.

  • feature_types :: character()
    Feature types the learner operates on. Must be a subset of mlr_reflections$task_feature_types.

  • properties :: character()
    Set of properties of the learner. Must be a subset of mlr_reflections$learner_properties.

  • data_formats :: character()
    Vector of supported data formats which can be processed during $train() and $predict(). Will be matched against the data formats supported by the Task, and the first data format specified in the learner which is also supported by the task will be picked. Defaults to "data.table".

  • packages :: character()
    Set of required packages.


  • id :: character(1)
    Stores the identifier of the learner.

  • task_type :: character(1)
    Stores the type of class this learner can operate on, e.g. "classif" or "regr". A complete list of task types is stored in mlr_reflections$task_types.

  • param_set :: paradox::ParamSet
    Description of available hyperparameters and hyperparameter settings.

  • predict_types :: character()
    Stores the possible predict types the learner is capable of. A complete list of candidate predict types, grouped by task type, is stored in mlr_reflections$learner_predict_types.

  • predict_type :: character(1)
    Stores the currently selected predict type. Must be an element of l$predict_types.

  • feature_types :: character()
    Stores the feature types the learner can handle, e.g. "logical", "numeric", or "factor". A complete list of candidate feature types, grouped by task type, is stored in mlr_reflections$task_feature_types.

  • properties :: character()
    Stores a set of properties/capabilities the learner has. A complete list of candidate properties, grouped by task type, is stored in mlr_reflections$learner_properties.

  • packages :: character()
    Stores the names of required packages.

  • fallback :: (Learner | NULL)
    Optionally stores a second Learner which is activated as fallback if this first Learner fails during train or predict. This mechanism is disabled unless you explicitly assign a learner to this slot. Additionally, you need to catch raised exceptions via encapsulation, see mlr_control().

  • hash :: character(1)
    Hash (unique identifier) for this object.


  • params(tag)
    character(1) -> named list()
    Returns a list of hyperparameter settings from param_set where the corresponding parameters in param_set are tagged with tag. I.e., l$params("train") returns all settings of hyperparameters used in the training step.

  • train(task)
    Task -> self
    Train the learner on the complete Task. The resulting model is stored in l$model.

  • predict(task)
    Task -> Prediction
    Uses l$model (fitted during train()) to return a Prediction object.

See also


# 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 = mlr_learners$get("classif.rpart") print(lrn)
#> <LearnerClassifRpart:classif.rpart> #> Parameters: list() #> Packages: rpart #> Predict Type: response #> Feature types: logical, integer, numeric, character, factor, ordered #> Properties: importance, missings, multiclass, selected_features, #> twoclass, weights #> #> Public: clone(), data_formats, fallback, feature_types, hash, id, #> importance(), model, packages, param_set, params(), predict_type, #> predict_types, predict(), properties, selected_features(), task_type, #> train()