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 19.42%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 61 12
#>         R 15 51
print(learner$importance())
#>           V11           V10           V12            V9           V48 
#>  0.1448657321  0.1101732547  0.1004941368  0.1002680002  0.0785811578 
#>           V49           V13            V5           V46           V27 
#>  0.0692506982  0.0624192615  0.0558659813  0.0555156450  0.0539710005 
#>           V28           V45            V4           V47           V51 
#>  0.0512145231  0.0500064648  0.0476002304  0.0463971364  0.0447021603 
#>           V52           V20           V44            V1           V15 
#>  0.0442863145  0.0426728967  0.0421767123  0.0388197602  0.0354814439 
#>           V29           V43           V21           V22           V18 
#>  0.0354565137  0.0350017434  0.0345897183  0.0331482090  0.0311564658 
#>            V2           V14           V35           V31           V56 
#>  0.0303186016  0.0296432363  0.0296390334  0.0265175260  0.0258249025 
#>           V30           V17           V19           V16            V8 
#>  0.0255908332  0.0254641871  0.0226565740  0.0224721619  0.0221557319 
#>           V37           V36            V6           V23           V59 
#>  0.0213203563  0.0210313952  0.0203605451  0.0195029920  0.0193344600 
#>           V25           V34           V24           V33           V50 
#>  0.0187152115  0.0181698556  0.0175911358  0.0167312283  0.0152690195 
#>            V3           V41            V7           V54           V38 
#>  0.0139767857  0.0136127807  0.0119393029  0.0111737937  0.0102547996 
#>           V42           V26           V60           V32           V39 
#>  0.0101535084  0.0097436315  0.0092574701  0.0077679687  0.0064794039 
#>           V58           V55           V40           V53           V57 
#>  0.0046649294  0.0040422498 -0.0002095510 -0.0007096132 -0.0062863757 

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

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