Skip to contents

Ensemble machine learning algorithm based on Random Ferns, which are a simplified, faster alternative to Random Forests. Calls rFerns::rFerns() from rFerns.

Initial parameter values

  • importance:

    • Actual default: FALSE

    • Initial value: "simple"

    • Reason for change: The default value of FALSE will resolve to "none", which turns importance calculation off. To enable importance calculation by default, importance is set to "simple".

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.rFerns")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”

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

  • Required Packages: mlr3, mlr3extralearners, rFerns

Parameters

IdTypeDefaultLevelsRange
consistentSeeduntypedNULL-
depthinteger5\([1, 16]\)
fernsinteger1000\((-\infty, \infty)\)
importanceuntypedFALSE-
saveForestlogicalTRUETRUE, FALSE-
threadsinteger0\((-\infty, \infty)\)

References

Kursa MB (2014). “rFerns: An Implementation of the Random Ferns Method for General-Purpose Machine Learning.” Journal of Statistical Software, 61(10), 1–13. https://www.jstatsoft.org/v61/i10/.

Ozuysal, Mustafa, Calonder, Michael, Lepetit, Vincent, Fua, Pascal (2010). “Fast Keypoint Recognition Using Random Ferns.” IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(3), 448-461. doi:10.1109/TPAMI.2009.23 .

See also

Author

annanzrv

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifRferns

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method importance()

The importance scores are extracted from the model slot importance.

Usage

LearnerClassifRferns$importance()

Returns

Named numeric().


Method oob_error()

OOB error is extracted from the model slot oobErr.

Usage

LearnerClassifRferns$oob_error()

Returns

numeric(1).


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifRferns$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("classif.rFerns")
print(learner)
#> 
#> ── <LearnerClassifRferns> (classif.rFerns): Random Ferns Classifier ────────────
#> • Model: -
#> • Parameters: importance=simple
#> • Packages: mlr3, mlr3extralearners, and rFerns
#> • Predict Types: [response]
#> • Feature Types: integer, numeric, factor, and ordered
#> • Encapsulation: none (fallback: -)
#> • Properties: importance, multiclass, oob_error, and twoclass
#> • Other settings: use_weights = 'error'

# Define a Task
task = tsk("sonar")

# Create train and test set
ids = partition(task)

# Train the learner on the training ids
learner$train(task, row_ids = ids$train)

print(learner$model)
#> 
#>  Forest of 1000 ferns of a depth 5.
#> 
#>  OOB error 17.27%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 65 11
#>         R 13 50
print(learner$importance())
#>           V11           V10            V9           V49           V48 
#>  1.082406e-01  1.006903e-01  9.021358e-02  8.802302e-02  8.244788e-02 
#>           V12           V13           V36           V46           V21 
#>  8.200642e-02  7.060736e-02  5.542505e-02  5.430061e-02  5.073568e-02 
#>           V45           V20           V37           V47           V35 
#>  5.034828e-02  4.086553e-02  3.829384e-02  3.753808e-02  2.818832e-02 
#>           V28           V44            V1           V19           V23 
#>  2.802669e-02  2.717660e-02  2.595274e-02  2.559450e-02  2.508379e-02 
#>           V22           V32            V5           V43           V29 
#>  2.503492e-02  2.443916e-02  2.320307e-02  2.170318e-02  2.127811e-02 
#>           V51           V15           V27           V52           V24 
#>  1.882539e-02  1.864240e-02  1.742279e-02  1.678782e-02  1.647563e-02 
#>           V26           V18           V31           V41           V60 
#>  1.589019e-02  1.520710e-02  1.421891e-02  1.367999e-02  1.343816e-02 
#>            V4           V17            V8            V3           V14 
#>  1.337975e-02  1.333121e-02  1.312740e-02  1.269011e-02  1.266965e-02 
#>           V42           V38           V55           V54           V50 
#>  1.160549e-02  1.156727e-02  1.068524e-02  9.850290e-03  9.729259e-03 
#>            V2           V56           V58           V16           V25 
#>  8.766584e-03  8.526964e-03  7.618198e-03  6.256473e-03  6.081066e-03 
#>           V34           V33            V7            V6           V59 
#>  4.798155e-03  4.457976e-03  3.950702e-03  3.333336e-03  3.243638e-03 
#>           V53           V40           V30           V39           V57 
#>  1.320183e-03  8.150895e-04 -6.230425e-05 -9.979730e-04 -1.506252e-03 

# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> classif.ce 
#>  0.1449275