Learn R Programming

mlr (version 2.12.1)

listLearners: Find matching learning algorithms.

Description

Returns learning algorithms which have specific characteristics, e.g. whether they support missing values, case weights, etc.

Note that the packages of all learners are loaded during the search if you create them. This can be a lot. If you do not create them we only inspect properties of the S3 classes. This will be a lot faster.

Note that for general cost-sensitive learning, mlr currently supports mainly “wrapper” approaches like CostSensWeightedPairsWrapper, which are not listed, as they are not basic R learning algorithms. The same applies for many multilabel methods, see, e.g., makeMultilabelBinaryRelevanceWrapper.

Usage

listLearners(obj = NA_character_, properties = character(0L),
  quiet = TRUE, warn.missing.packages = TRUE, check.packages = FALSE,
  create = FALSE)

# S3 method for default listLearners(obj = NA_character_, properties = character(0L), quiet = TRUE, warn.missing.packages = TRUE, check.packages = FALSE, create = FALSE)

# S3 method for character listLearners(obj = NA_character_, properties = character(0L), quiet = TRUE, warn.missing.packages = TRUE, check.packages = FALSE, create = FALSE)

# S3 method for Task listLearners(obj = NA_character_, properties = character(0L), quiet = TRUE, warn.missing.packages = TRUE, check.packages = TRUE, create = FALSE)

Arguments

obj

(`character(1)` | [Task]) Either `character(1)` task or the type of the task, in the latter case one of: “classif” “regr” “surv” “costsens” “cluster” “multilabel”. Default is `NA` matching all types.

properties

(character) Set of required properties to filter for. Default is character(0).

quiet

(logical(1)) Construct learners quietly to check their properties, shows no package startup messages. Turn off if you suspect errors. Default is TRUE.

warn.missing.packages

(logical(1)) If some learner cannot be constructed because its package is missing, should a warning be shown? Default is TRUE.

check.packages

(logical(1)) Check if required packages are installed. Calls find.package(). If create is TRUE, this is done implicitly and the value of this parameter is ignored. If create is FALSE and check.packages is TRUE the returned table only contains learners whose dependencies are installed. If check.packages set to FALSE, learners that cannot actually be constructed because of missing packages may be returned. Default is FALSE.

create

(logical(1)) Instantiate objects (or return info table)? Packages are loaded if and only if this option is TRUE. Default is FALSE.

Value

([data.frame|list` of [Learner]). Either a descriptive data.frame that allows access to all properties of the learners or a list of created learner objects (named by ids of listed learners).

[data.frame|list` of [Learner]: R:data.frame

Examples

Run this code
# NOT RUN {
listLearners("classif", properties = c("multiclass", "prob"))
data = iris
task = makeClassifTask(data = data, target = "Species")
listLearners(task)
# }

Run the code above in your browser using DataLab