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 16.55%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 64 12
#>         R 11 52
print(learner$importance())
#>          V11          V49           V9          V48          V51          V12 
#>  0.124769092  0.084246324  0.083872781  0.083639781  0.078104802  0.077842032 
#>          V10          V47          V46          V45          V44          V37 
#>  0.076872351  0.076702845  0.070544664  0.062283030  0.051481792  0.049007821 
#>          V36           V4          V21          V20          V43          V35 
#>  0.046932632  0.045515427  0.042296777  0.042005823  0.038009372  0.035437501 
#>          V16          V52          V32           V8          V29          V27 
#>  0.035210309  0.034136203  0.032918632  0.031363546  0.029901531  0.029454194 
#>           V5          V17          V28          V22          V31          V13 
#>  0.029382502  0.029268896  0.027803579  0.027494859  0.027302826  0.026473180 
#>          V34          V23          V26          V15          V42          V59 
#>  0.024542751  0.023921107  0.021914867  0.021242575  0.021182790  0.020466964 
#>          V19           V6          V38          V30          V33          V24 
#>  0.019940944  0.019089544  0.018867118  0.018099601  0.016988043  0.016512949 
#>          V14           V3          V18          V55           V1          V25 
#>  0.016208018  0.014231375  0.014151893  0.013136989  0.009907824  0.009807533 
#>          V39          V40          V50          V54           V2          V53 
#>  0.009382960  0.007514409  0.006071191  0.005496283  0.005471071  0.005314317 
#>          V41          V58           V7          V60          V56          V57 
#>  0.004647017  0.002510538  0.002194696  0.001379113 -0.000817734 -0.002019844 

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

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