Skip to contents

Dictionary

This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn():

mlr_learners$get("classif.randomForest")
lrn("classif.randomForest")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “numeric”, “factor”, “ordered”

  • Required Packages: mlr3extralearners, randomForest

Parameters

IdTypeDefaultLevelsRange
ntreeinteger500\([1, \infty)\)
mtryinteger-\([1, \infty)\)
replacelogicalTRUETRUE, FALSE\((-\infty, \infty)\)
classwtlistNULL\((-\infty, \infty)\)
cutofflist-\((-\infty, \infty)\)
stratalist-\((-\infty, \infty)\)
sampsizelist-\((-\infty, \infty)\)
nodesizeinteger1\([1, \infty)\)
maxnodesinteger-\([1, \infty)\)
importancecharacterFALSEaccuracy, gini, none, FALSE\((-\infty, \infty)\)
localImplogicalFALSETRUE, FALSE\((-\infty, \infty)\)
proximitylogicalFALSETRUE, FALSE\((-\infty, \infty)\)
oob.proxlogical-TRUE, FALSE\((-\infty, \infty)\)
norm.voteslogicalTRUETRUE, FALSE\((-\infty, \infty)\)
do.tracelogicalFALSETRUE, FALSE\((-\infty, \infty)\)
keep.forestlogicalTRUETRUE, FALSE\((-\infty, \infty)\)
keep.inbaglogicalFALSETRUE, FALSE\((-\infty, \infty)\)
predict.alllogicalFALSETRUE, FALSE\((-\infty, \infty)\)
nodeslogicalFALSETRUE, FALSE\((-\infty, \infty)\)

References

Breiman, L. (2001). Random Forests Machine Learning https://doi.org/10.1023/A:1010933404324

See also

Author

pat-s

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifRandomForest

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method importance()

The importance scores are extracted from the slot importance. Parameter 'importance' must be set to either "accuracy" or "gini".

Usage

LearnerClassifRandomForest$importance()

Returns

Named numeric().


Method oob_error()

OOB errors are extracted from the model slot err.rate.

Usage

LearnerClassifRandomForest$oob_error()

Returns

numeric(1).


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifRandomForest$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (requireNamespace("randomForest", quietly = TRUE)) {
  learner = mlr3::lrn("classif.randomForest")
  print(learner)

  # available parameters:
  learner$param_set$ids()
}
#> <LearnerClassifRandomForest:classif.randomForest>
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, mlr3extralearners, randomForest
#> * Predict Type: response
#> * Feature types: numeric, factor, ordered
#> * Properties: importance, multiclass, oob_error, twoclass, weights
#>  [1] "ntree"       "mtry"        "replace"     "classwt"     "cutoff"     
#>  [6] "strata"      "sampsize"    "nodesize"    "maxnodes"    "importance" 
#> [11] "localImp"    "proximity"   "oob.prox"    "norm.votes"  "do.trace"   
#> [16] "keep.forest" "keep.inbag"  "predict.all" "nodes"