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 21.58%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 63 13
#>         R 17 46
print(learner$importance())
#>           V11           V10           V12           V48           V49 
#>  0.1256067746  0.0975876073  0.0867632945  0.0790285113  0.0787830897 
#>            V9           V47           V13           V51           V21 
#>  0.0753530569  0.0565892233  0.0544301561  0.0538574367  0.0502790627 
#>           V45            V5           V27           V31           V36 
#>  0.0490089057  0.0432580231  0.0397050668  0.0382913310  0.0382322124 
#>           V20            V6           V46            V1           V22 
#>  0.0350646277  0.0349971471  0.0342943593  0.0342232885  0.0341546229 
#>            V4           V23           V43           V16           V34 
#>  0.0310809966  0.0300779092  0.0299138053  0.0290949467  0.0278317589 
#>           V28           V50           V15            V2           V59 
#>  0.0275516878  0.0269001265  0.0254594821  0.0243792532  0.0237440196 
#>           V33           V44           V30           V14            V3 
#>  0.0233622137  0.0227124473  0.0214175722  0.0209003401  0.0205354539 
#>           V39           V37           V54           V26           V17 
#>  0.0195118572  0.0190319683  0.0190186207  0.0183503742  0.0181742401 
#>           V35           V38           V29           V42           V32 
#>  0.0177776532  0.0169343848  0.0161206700  0.0148432479  0.0142072049 
#>            V8           V58           V56           V52           V19 
#>  0.0141963092  0.0138850799  0.0130243629  0.0106596966  0.0100633805 
#>           V41           V55           V60           V18           V57 
#>  0.0097599147  0.0082817516  0.0072749107  0.0066925796  0.0058896874 
#>           V24           V40           V53           V25            V7 
#>  0.0050186015  0.0028422547  0.0017897748  0.0005091283 -0.0053318740 

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

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