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 22.30%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 59 14
#>         R 17 49
print(learner$importance())
#>           V12           V11           V10            V9           V13 
#>  1.162980e-01  1.103730e-01  9.740880e-02  9.425460e-02  6.894428e-02 
#>           V49           V48           V21           V44           V20 
#>  6.465448e-02  5.460105e-02  4.784094e-02  4.632376e-02  4.321608e-02 
#>           V51           V27           V37           V45           V35 
#>  4.247069e-02  4.180416e-02  3.978427e-02  3.346462e-02  3.258070e-02 
#>           V28           V34           V22           V47           V23 
#>  3.242703e-02  3.234935e-02  3.187369e-02  3.045901e-02  3.030010e-02 
#>           V14           V46           V36            V4           V39 
#>  3.025649e-02  2.882914e-02  2.774260e-02  2.741076e-02  2.638650e-02 
#>           V31           V32           V29            V8            V1 
#>  2.576748e-02  2.449125e-02  2.433348e-02  2.402279e-02  2.318048e-02 
#>           V43           V52           V33           V18           V24 
#>  2.273402e-02  2.249895e-02  2.218064e-02  2.125010e-02  2.111666e-02 
#>           V15            V7           V60           V16           V19 
#>  2.026987e-02  1.994046e-02  1.983310e-02  1.605155e-02  1.536508e-02 
#>            V2            V5           V26           V38            V6 
#>  1.489893e-02  1.217494e-02  1.180421e-02  1.051864e-02  1.024478e-02 
#>           V30           V58           V17            V3           V42 
#>  9.632549e-03  9.520562e-03  9.368892e-03  6.347842e-03  6.218906e-03 
#>           V59           V56           V25           V53           V55 
#>  4.430941e-03  4.009241e-03  3.200032e-03  1.791853e-03  1.724902e-03 
#>           V54           V50           V41           V40           V57 
#>  9.396293e-04 -2.650869e-05 -5.101303e-04 -2.625843e-03 -5.878992e-03 

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

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