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 15.11%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 66 10
#>         R 11 52
print(learner$importance())
#>          V10          V12          V11          V20          V13          V49 
#> 0.1437897160 0.1388430309 0.1303524717 0.0892176145 0.0840195803 0.0804538853 
#>           V9          V48          V21          V47          V36          V22 
#> 0.0760617067 0.0743753675 0.0704739693 0.0636759496 0.0565312811 0.0462393676 
#>          V46          V28          V27          V52          V45          V37 
#> 0.0431798539 0.0427354073 0.0404844784 0.0398103911 0.0391336566 0.0376317559 
#>          V51           V4          V43          V31          V19           V8 
#> 0.0369777038 0.0363655526 0.0343293514 0.0307717471 0.0302279512 0.0295732442 
#>          V14          V18          V42           V5           V1          V32 
#> 0.0295426942 0.0286590754 0.0279059021 0.0275149494 0.0261439597 0.0257058446 
#>          V26           V6          V34          V15          V30          V44 
#> 0.0253048476 0.0247364184 0.0239805304 0.0239537115 0.0238390434 0.0229782262 
#>          V29          V35          V59          V58          V16          V17 
#> 0.0222218678 0.0203595674 0.0197668464 0.0195425806 0.0187575947 0.0184572005 
#>           V3          V33          V25          V53          V23          V56 
#> 0.0183238171 0.0181112725 0.0166889101 0.0158553827 0.0145880514 0.0138739185 
#>           V2          V24          V39          V41          V60          V40 
#> 0.0128480948 0.0108924913 0.0090994101 0.0090542381 0.0088244455 0.0086452781 
#>          V38          V55          V50          V54           V7          V57 
#> 0.0078896682 0.0076400280 0.0066980276 0.0042290617 0.0020415816 0.0009862199 

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

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