mlr_learners_classif.imbalanced_rfsrc: Classification Imbalanced Random Forest Src Learner

mlr_learners_classif.imbalanced_rfsrcR Documentation

Classification Imbalanced Random Forest Src Learner

Description

Imbalanced Random forest for classification between two classes. Calls randomForestSRC::imbalanced.rfsrc() from from randomForestSRC.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.imbalanced_rfsrc")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”

  • Required Packages: mlr3, randomForestSRC

Parameters

Id Type Default Levels Range
ntree integer 500 [1, \infty)
method character rfq rfq, brf, standard -
block.size integer 10 [1, \infty)
fast logical FALSE TRUE, FALSE -
ratio numeric - [0, 1]
mtry integer - [1, \infty)
mtry.ratio numeric - [0, 1]
nodesize integer 15 [1, \infty)
nodedepth integer - [1, \infty)
splitrule character gini gini, auc, entropy -
nsplit integer 10 [0, \infty)
importance character FALSE FALSE, TRUE, none, permute, random, anti -
bootstrap character by.root by.root, by.node, none, by.user -
samptype character swor swor, swr -
samp untyped - -
membership logical FALSE TRUE, FALSE -
sampsize untyped - -
sampsize.ratio numeric - [0, 1]
na.action character na.omit na.omit, na.impute -
nimpute integer 1 [1, \infty)
ntime integer - [1, \infty)
cause integer - [1, \infty)
proximity character FALSE FALSE, TRUE, inbag, oob, all -
distance character FALSE FALSE, TRUE, inbag, oob, all -
forest.wt character FALSE FALSE, TRUE, inbag, oob, all -
xvar.wt untyped - -
split.wt untyped - -
forest logical TRUE TRUE, FALSE -
var.used character FALSE FALSE, all.trees, by.tree -
split.depth character FALSE FALSE, all.trees, by.tree -
seed integer - (-\infty, -1]
do.trace logical FALSE TRUE, FALSE -
statistics logical FALSE TRUE, FALSE -
get.tree untyped - -
outcome character train train, test -
ptn.count integer 0 [0, \infty)
cores integer 1 [1, \infty)
save.memory logical FALSE TRUE, FALSE -
perf.type character - gmean, misclass, brier, none -
case.depth logical FALSE TRUE, FALSE -

Custom mlr3 parameters

  • mtry: This hyperparameter can alternatively be set via the added hyperparameter mtry.ratio as mtry = max(ceiling(mtry.ratio * n_features), 1). Note that mtry and mtry.ratio are mutually exclusive.

  • sampsize: This hyperparameter can alternatively be set via the added hyperparameter sampsize.ratio as sampsize = max(ceiling(sampsize.ratio * n_obs), 1). Note that sampsize and sampsize.ratio are mutually exclusive.

  • cores: This value is set as the option rf.cores during training and is set to 1 by default.

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifImbalancedRandomForestSRC

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerClassifImbalancedRandomForestSRC$new()

Method importance()

The importance scores are extracted from the slot importance.

Usage
LearnerClassifImbalancedRandomForestSRC$importance()
Returns

Named numeric().


Method selected_features()

Selected features are extracted from the model slot var.used.

Usage
LearnerClassifImbalancedRandomForestSRC$selected_features()
Returns

character().


Method oob_error()

OOB error extracted from the model slot err.rate.

Usage
LearnerClassifImbalancedRandomForestSRC$oob_error()
Returns

numeric().


Method clone()

The objects of this class are cloneable with this method.

Usage
LearnerClassifImbalancedRandomForestSRC$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

HarutyunyanLiana

References

O’Brien R, Ishwaran H (2019). “A random forests quantile classifier for class imbalanced data.” Pattern Recognition, 90, 232–249. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.patcog.2019.01.036")}.

Chao C, Leo B (2004). “Using Random Forest to Learn Imbalanced Data.” University of California, Berkeley.

See Also

Examples


# Define the Learner
learner = mlr3::lrn("classif.imbalanced_rfsrc", importance = "TRUE")
print(learner)

# Define a Task
task = mlr3::tsk("sonar")
# Create train and test set
ids = mlr3::partition(task)

# Train the learner on the training ids
learner$train(task, row_ids = ids$train)

print(learner$model)
print(learner$importance())

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

# Score the predictions
predictions$score()


mlr-org/mlr3extralearners documentation built on Dec. 21, 2024, 2:21 p.m.