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 23.02%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 59 13
#>         R 19 48
print(learner$importance())
#>          V11          V12          V10          V36          V48          V49 
#>  0.095346869  0.091055702  0.061209906  0.060661183  0.058750451  0.057183361 
#>          V28          V27           V9          V17          V37          V52 
#>  0.052181149  0.050231364  0.046335195  0.043340622  0.042927205  0.042520327 
#>          V51          V47          V13          V34          V21          V20 
#>  0.037751216  0.037715749  0.036982209  0.032699358  0.031571430  0.029540379 
#>          V35           V8          V29           V5          V45          V46 
#>  0.026837467  0.025864830  0.025389048  0.025122449  0.024736269  0.024323998 
#>          V32          V16          V15          V23          V31          V53 
#>  0.024222149  0.024220906  0.023602794  0.021717156  0.021505821  0.021111409 
#>          V19          V33          V26          V54          V22          V44 
#>  0.020609009  0.018647622  0.018601360  0.018515766  0.018088879  0.017616058 
#>          V30          V43          V39          V42          V24          V18 
#>  0.016550707  0.015621821  0.015450984  0.014847012  0.014447626  0.013766838 
#>           V6          V59           V2           V7           V4          V14 
#>  0.013564907  0.013551867  0.012416093  0.009384188  0.008713674  0.008235718 
#>          V56          V25          V55          V57           V1          V58 
#>  0.007692231  0.007076105  0.006914660  0.006600236  0.005604486  0.004969320 
#>           V3          V50          V41          V38          V60          V40 
#>  0.003499728  0.002177860  0.001994367  0.001156739 -0.002488902 -0.004805076 

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

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