makeLearner: Create learner object.

Description Usage Arguments Value See Also Examples

Description

For a classification learner the predict.type can be set to “prob” to predict probabilities and the maximum value selects the label. The threshold used to assign the label can later be changed using the setThreshold function.

To see all possible properties of a learner, go to: LearnerProperties.

Usage

1
2
3
makeLearner(cl, id = cl, predict.type = "response",
  predict.threshold = NULL, fix.factors.prediction = FALSE, ...,
  par.vals = list(), config = list())

Arguments

cl

[character(1)]
Class of learner. By convention, all classification learners start with “classif.”, all regression learners with “regr.”, all survival learners start with “surv.”, all clustering learners with “cluster.”, and all multilabel classification learners start with “multilabel.”. A list of all integrated learners is available on the learners help page.

id

[character(1)]
Id string for object. Used to display object. Default is cl.

predict.type

[character(1)]
Classification: “response” (= labels) or “prob” (= probabilities and labels by selecting the ones with maximal probability). Regression: “response” (= mean response) or “se” (= standard errors and mean response). Survival: “response” (= some sort of orderable risk) or “prob” (= time dependent probabilities). Clustering: “response” (= cluster IDS) or “prob” (= fuzzy cluster membership probabilities), Multilabel: “response” (= logical matrix indicating the predicted class labels) or “prob” (= probabilities and corresponding logical matrix indicating class labels). Default is “response”.

predict.threshold

[numeric]
Threshold to produce class labels. Has to be a named vector, where names correspond to class labels. Only for binary classification it can be a single numerical threshold for the positive class. See setThreshold for details on how it is applied. Default is NULL which means 0.5 / an equal threshold for each class.

fix.factors.prediction

[logical(1)]
In some cases, problems occur in underlying learners for factor features during prediction. If the new features have LESS factor levels than during training (a strict subset), the learner might produce an error like “type of predictors in new data do not match that of the training data”. In this case one can repair this problem by setting this option to TRUE. We will simply add the missing factor levels missing from the test feature (but present in training) to that feature. Default is FALSE.

...

[any]
Optional named (hyper)parameters. Alternatively these can be given using the par.vals argument.

par.vals

[list]
Optional list of named (hyper)parameters. The arguments in ... take precedence over values in this list. We strongly encourage you to use one or the other to pass (hyper)parameters to the learner but not both.

config

[named list]
Named list of config option to overwrite global settings set via configureMlr for this specific learner.

Value

[Learner].

See Also

Other learner: LearnerProperties, getClassWeightParam, getHyperPars, getLearnerId, getLearnerPackages, getLearnerParVals, getLearnerParamSet, getLearnerPredictType, getLearnerShortName, getLearnerType, getParamSet, helpLearnerParam, helpLearner, makeLearners, removeHyperPars, setHyperPars, setId, setLearnerId, setPredictThreshold, setPredictType

Examples

1
2
3
4
makeLearner("classif.rpart")
makeLearner("classif.lda", predict.type = "prob")
lrn = makeLearner("classif.lda", method = "t", nu = 10)
print(lrn$par.vals)

Najah-lshanableh/R-data-mining2 documentation built on May 6, 2019, 10:11 a.m.