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.74%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 60 17
#>         R 16 46
print(learner$importance())
#>          V10          V11          V12           V9          V49          V47 
#>  0.119156700  0.116746584  0.101580412  0.099394748  0.094928941  0.081198787 
#>          V48          V46          V45          V13          V21          V43 
#>  0.078989818  0.073662656  0.064436960  0.059097076  0.055879742  0.046997962 
#>          V44          V20          V58          V52           V2           V8 
#>  0.046092015  0.044458395  0.041388410  0.034212497  0.033701433  0.033528759 
#>          V27          V34          V36          V35          V51           V3 
#>  0.032343412  0.031658033  0.031097631  0.029427179  0.029185905  0.028207543 
#>          V16          V28           V6          V22          V17          V54 
#>  0.026690337  0.024692571  0.024674762  0.024194868  0.023658619  0.020458691 
#>          V14          V29          V18          V15          V31          V41 
#>  0.020175598  0.019958257  0.019957418  0.019851162  0.019358298  0.019233155 
#>          V23          V40          V39          V38          V19          V50 
#>  0.018841159  0.018643144  0.017672143  0.016602263  0.016098495  0.016014927 
#>          V55          V32          V24          V42          V56           V4 
#>  0.016000161  0.015848651  0.015470585  0.014948393  0.013778064  0.013552462 
#>           V1          V30           V7           V5          V25          V37 
#>  0.012847738  0.011981860  0.011127462  0.011118567  0.010033509  0.008961074 
#>          V33          V26          V59          V53          V60          V57 
#>  0.007446717  0.005408215  0.004072239  0.003573798  0.002798239 -0.004662577 

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

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