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 19.42%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 60 17
#>         R 10 52
print(learner$importance())
#>          V12          V11           V9          V10          V45           V4 
#>  0.105194594  0.102770295  0.091498342  0.089577562  0.072980499  0.062939083 
#>          V48          V49          V46          V47          V13          V51 
#>  0.061350196  0.055485613  0.054751434  0.052775415  0.052336388  0.051444843 
#>          V36           V8          V27          V28          V18           V5 
#>  0.051368632  0.047475191  0.043639016  0.043498291  0.041692739  0.041469106 
#>          V35           V6          V52           V1          V16          V44 
#>  0.036830746  0.036074687  0.035441909  0.034188044  0.033339314  0.030593524 
#>          V17          V37          V29          V43           V3          V20 
#>  0.029733008  0.029369142  0.028924801  0.027703255  0.026257748  0.025303145 
#>          V19          V39          V21          V15          V38           V7 
#>  0.024952396  0.020102946  0.019889136  0.019478827  0.018103397  0.017353551 
#>          V58          V53          V31           V2          V14          V41 
#>  0.017262480  0.017166173  0.015918749  0.015718309  0.015497326  0.014910917 
#>          V22          V54          V32          V59          V23          V56 
#>  0.014292822  0.014091817  0.012739955  0.011370769  0.010039442  0.009317441 
#>          V26          V33          V30          V57          V50          V55 
#>  0.008509531  0.007931494  0.007511433  0.007105539  0.006027573  0.005686036 
#>          V34          V24          V40          V25          V60          V42 
#>  0.005466126  0.005425540  0.005277734  0.004594576  0.001996738 -0.003060453 

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

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