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', 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 15.11%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 67 12
#>         R  9 51
print(learner$importance())
#>           V12           V11           V10           V49           V36 
#>  0.1696690250  0.1239414018  0.0938357977  0.0776508394  0.0762110943 
#>           V48            V9           V47           V37           V13 
#>  0.0742216134  0.0710068402  0.0699791040  0.0568867726  0.0552448018 
#>           V51            V5           V22           V45           V35 
#>  0.0508254004  0.0500656291  0.0485159302  0.0424811321  0.0390120884 
#>           V20           V52           V21           V46           V15 
#>  0.0374199617  0.0368451875  0.0364735532  0.0340809078  0.0328392319 
#>           V29            V6           V14            V1            V4 
#>  0.0310680989  0.0310349575  0.0293554815  0.0292340384  0.0288205994 
#>           V42           V30           V27           V26           V28 
#>  0.0283134125  0.0264494417  0.0262518133  0.0259500362  0.0256219617 
#>           V43           V34           V16           V38           V23 
#>  0.0255837273  0.0254172312  0.0243354767  0.0229928520  0.0226114855 
#>           V17           V31            V8           V55           V59 
#>  0.0213943695  0.0210812019  0.0206300011  0.0201096765  0.0197214681 
#>           V44           V50           V19           V32           V57 
#>  0.0190430392  0.0182117850  0.0172992187  0.0137333880  0.0116108696 
#>           V24           V33           V54           V60           V39 
#>  0.0110970384  0.0089557705  0.0086017529  0.0077439334  0.0075314202 
#>           V25            V7           V41           V53           V18 
#>  0.0066708334  0.0065984766  0.0051400220  0.0047675011  0.0021651190 
#>            V2           V58            V3           V56           V40 
#>  0.0009691677 -0.0002198514 -0.0010952942 -0.0016452771 -0.0023126046 

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

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