Predefined learners are stored in mlr_learners.

Format

R6Class object.

Usage

# Construction
l = Learner$new(id, task_type, feature_types= character(0L), predict_types = character(0L), packages = character(0L), param_set = ParamSet$new(), param_vals = list(), properties = character(0L))
l = LearnerClassif$new(id, feature_types = character(0L), predict_types = "response", packages = character(0L), param_set = ParamSet$new(), param_vals = list(), properties = character(0L))
l = LearnerRegr$new(id, feature_types = character(0L), predict_types = "response", packages = character(0L), param_set = ParamSet$new(), param_vals = list(), properties = character(0L))
    # Members
l$fallback
l$feature_types
l$hash
l$id
l$model
l$packages
l$param_set
l$param_vals
l$params_predict
l$params_train
l$predict_type
l$predict_types
l$properties
l$task_type
    # Methods
l$train(task)
l$predict(task)

Arguments

  • id (character(1)): Identifier for this object.

  • task_type (character(1)): Type of the task the learner can operator on. E.g., "classif" or "regr".

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

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

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

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

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

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

  • task (Task): Task to train/predict on.

Details

  • $fallback (Learner | NULL) optionally stores a fallback learner which is used to generate predictions if this learner fails to train or predict. This mechanism is disabled unless you explicitly assign a learner to this slot.

  • $feature_types (character()) stores the feature types the learner can handle, e.g. "logical", "numeric", or "factor".

  • $hash (character(1)) stores a checksum calculated on the id and param_vals. This hash is cached internally.

  • $id (character(1)) stores the identifier of the object.

  • $packages (character()) stores the names of required packages.

  • $param_set (paradox::ParamSet) describes the available hyperparameter and possible settings.

  • $param_vals (named list()) stores the list set hyperparameter values.

  • $params_predict (list()) stores the settings that have been used for prediction.

  • $params_train (list()) stores the settings that have been used for training

  • $predict_type (character(1)) stores the currently selected predict type.

  • $predict_types (character()) stores the possible predict types the learner is capable of. For classification, feasible values are "response" and "prob", for regression "response" and "se" can be specified.

  • $properties (character()) is a set of tags which describe the properties of the learner.

  • $task_type (character(1)) stores the type of class this learner can operate on, e.g. "classif" or "regr".

  • $new() creates a new object of class Learner.

  • $predict() takes a Task and uses self$model (fitted during train()) to return a Prediction object.

  • $train() takes a Task, sets the slot model and returns self.

See also