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 17.27%; OOB confusion matrix:
#>          True
#> Predicted  M  R
#>         M 63 15
#>         R  9 52
print(learner$importance())
#>         V12         V11          V9         V10         V49         V36 
#> 0.123259590 0.099125616 0.081870867 0.076620630 0.068546450 0.060398844 
#>         V47         V48         V21         V13         V31         V46 
#> 0.053019976 0.052855814 0.051048894 0.049307576 0.047977674 0.045381497 
#>         V20         V37         V35         V45         V51         V43 
#> 0.043541528 0.042225583 0.041784664 0.040580893 0.039113749 0.037733681 
#>         V17         V22         V14          V4         V42         V15 
#> 0.035755128 0.034357372 0.034238752 0.033176269 0.032308745 0.031998603 
#>         V23         V44          V8         V30          V5         V32 
#> 0.031858850 0.031115113 0.027057592 0.026966712 0.026644376 0.025808526 
#>          V2         V41         V19         V24         V57          V1 
#> 0.022570397 0.020315370 0.019880125 0.019731670 0.019677578 0.019638551 
#>         V54         V33         V39         V29         V34         V18 
#> 0.019565908 0.018891638 0.018516543 0.018301420 0.018236421 0.018069539 
#>         V16         V59         V26         V52         V28         V50 
#> 0.015837826 0.015121843 0.014087832 0.014043933 0.013438668 0.013106012 
#>         V58         V27          V7         V38         V53          V3 
#> 0.012468120 0.012064149 0.011006539 0.009780137 0.009088357 0.008905590 
#>          V6         V40         V56         V60         V55         V25 
#> 0.008829446 0.006861116 0.005836554 0.005114090 0.004450283 0.003522600 

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

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