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 18.71%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 62 11
#>         R 15 51
print(learner$importance())
#>         V11          V9         V12         V49         V10         V48 
#> 0.112559665 0.097022897 0.086017915 0.077968021 0.076163693 0.067739827 
#>         V46         V13         V36         V47         V45         V37 
#> 0.065652964 0.060541010 0.056514284 0.048473786 0.048386548 0.046371006 
#>         V28         V20          V2         V52          V1         V35 
#> 0.046265523 0.045648463 0.045183922 0.041448640 0.041047507 0.037406410 
#>          V4         V43         V51          V8         V44         V29 
#> 0.036487375 0.032700540 0.032658946 0.032107481 0.032104120 0.031869569 
#>         V17         V30         V58         V21         V23         V55 
#> 0.029789123 0.027268035 0.026752728 0.025215187 0.024255334 0.023624020 
#>         V16          V5         V24         V50         V19         V15 
#> 0.022764141 0.022589907 0.022504664 0.021806823 0.021413023 0.020074275 
#>          V6         V31         V27         V14         V25         V60 
#> 0.019615548 0.019612755 0.019352472 0.019171040 0.018394459 0.017997818 
#>         V18         V42         V32         V39         V59         V38 
#> 0.017597858 0.017527366 0.016187623 0.015243823 0.014246975 0.013149638 
#>         V34          V7         V57         V22         V56         V26 
#> 0.013009008 0.012879599 0.012548566 0.011808563 0.010791618 0.010364620 
#>         V33         V40         V54         V53         V41          V3 
#> 0.009828477 0.009065672 0.006188236 0.005624539 0.005562365 0.001737193 

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

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