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


LearnerClassifRferns$new()

Creates a new instance of this R6 class.

Usage


LearnerClassifRferns$importance()

The importance scores are extracted from the model slot importance.

Usage

LearnerClassifRferns$importance()

Returns

Named numeric().


LearnerClassifRferns$oob_error()

OOB error is extracted from the model slot oobErr.

Usage

LearnerClassifRferns$oob_error()

Returns

numeric(1).


LearnerClassifRferns$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', predict_raw = 'FALSE'

# 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 20.14%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 63 17
#>         R 11 48
print(learner$importance())
#>           V11           V12           V10            V9           V36 
#>  0.1629945192  0.1371393534  0.1195580328  0.0980889172  0.0681149272 
#>           V13           V48           V47           V49           V21 
#>  0.0680247357  0.0606668072  0.0500019587  0.0465285231  0.0427804855 
#>           V37           V35           V20            V4           V19 
#>  0.0421735351  0.0387993265  0.0385042664  0.0377329028  0.0357671727 
#>           V29           V28           V22           V15            V8 
#>  0.0357292543  0.0355128401  0.0354132206  0.0337812303  0.0334883671 
#>           V43            V6           V16           V45           V51 
#>  0.0320823980  0.0310301920  0.0303289380  0.0285626807  0.0283170868 
#>           V27           V26           V14            V3           V23 
#>  0.0276960898  0.0274189078  0.0268994155  0.0268391491  0.0266741578 
#>            V5           V52           V30           V24            V1 
#>  0.0265115007  0.0263158017  0.0251067961  0.0238916956  0.0238774385 
#>           V46           V50           V31           V18           V42 
#>  0.0233063840  0.0228390785  0.0215882824  0.0207836081  0.0184507134 
#>           V38           V44            V7           V59           V60 
#>  0.0184442276  0.0166051547  0.0156376830  0.0155249233  0.0133486272 
#>           V55           V54            V2           V57           V17 
#>  0.0133005014  0.0123412022  0.0109682762  0.0105350126  0.0101093025 
#>           V34           V32           V41           V33           V53 
#>  0.0086342911  0.0078207893  0.0064809346  0.0057445560  0.0055172523 
#>           V40           V58           V25           V56           V39 
#>  0.0014323252  0.0006600937 -0.0010112054 -0.0011708156 -0.0036876929 

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

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