Oblique Random Forest Classifier
Source:R/learner_aorsf_classif_aorsf.R
mlr_learners_classif.aorsf.RdAccelerated oblique random classification forest.
Calls aorsf::orsf() from aorsf.
Note that although the learner has the property "missing" and it can in
principle deal with missing values, the behaviour has to be configured using
the parameter na_action.
Initial parameter values
n_thread: This parameter is initialized to 1 (default is 0) to avoid conflicts with the mlr3 parallelization.pred_simplifyhas to be TRUE, otherwise response is NA in prediction
Meta Information
Task type: “classif”
Predict Types: “response”, “prob”
Feature Types: “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3extralearners, aorsf
Parameters
| Id | Type | Default | Levels | Range |
| attach_data | logical | TRUE | TRUE, FALSE | - |
| epsilon | numeric | 1e-09 | \([0, \infty)\) | |
| importance | character | anova | none, anova, negate, permute | - |
| importance_max_pvalue | numeric | 0.01 | \([1e-04, 0.9999]\) | |
| leaf_min_events | integer | 1 | \([1, \infty)\) | |
| leaf_min_obs | integer | 5 | \([1, \infty)\) | |
| max_iter | integer | 20 | \([1, \infty)\) | |
| method | character | glm | glm, net, pca, random | - |
| mtry | integer | NULL | \([1, \infty)\) | |
| mtry_ratio | numeric | - | \([0, 1]\) | |
| n_retry | integer | 3 | \([0, \infty)\) | |
| n_split | integer | 5 | \([1, \infty)\) | |
| n_thread | integer | - | \([0, \infty)\) | |
| n_tree | integer | 500 | \([1, \infty)\) | |
| na_action | character | fail | fail, impute_meanmode | - |
| net_mix | numeric | 0.5 | \((-\infty, \infty)\) | |
| oobag | logical | FALSE | TRUE, FALSE | - |
| oobag_eval_every | integer | NULL | \([1, \infty)\) | |
| oobag_fun | untyped | NULL | - | |
| oobag_pred_type | character | prob | none, leaf, prob, class | - |
| pred_aggregate | logical | TRUE | TRUE, FALSE | - |
| sample_fraction | numeric | 0.632 | \([0, 1]\) | |
| sample_with_replacement | logical | TRUE | TRUE, FALSE | - |
| scale_x | logical | FALSE | TRUE, FALSE | - |
| split_min_events | integer | 5 | \([1, \infty)\) | |
| split_min_obs | integer | 10 | \([1, \infty)\) | |
| split_min_stat | numeric | NULL | \([0, \infty)\) | |
| split_rule | character | gini | gini, cstat | - |
| target_df | integer | NULL | \([1, \infty)\) | |
| tree_seeds | integer | NULL | \([1, \infty)\) | |
| verbose_progress | logical | FALSE | TRUE, FALSE | - |
See also
as.data.table(mlr_learners)for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifObliqueRandomForest
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerClassif$predict_newdata_fast()
Method oob_error()
OOB concordance error extracted from the model slot
eval_oobag$stat_values
Examples
# Define the Learner
learner = lrn("classif.aorsf")
print(learner)
#>
#> ── <LearnerClassifObliqueRandomForest> (classif.aorsf): Oblique Random Forest Cl
#> • Model: -
#> • Parameters: n_thread=1
#> • Packages: mlr3, mlr3extralearners, and aorsf
#> • Predict Types: [response] and prob
#> • Feature Types: integer, numeric, factor, and ordered
#> • Encapsulation: none (fallback: -)
#> • Properties: importance, missings, multiclass, oob_error, twoclass, and
#> weights
#> • Other settings: use_weights = 'use'
# 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)
#> ---------- Oblique random classification forest
#>
#> Linear combinations: Logistic regression
#> N observations: 139
#> N classes: 2
#> N trees: 500
#> N predictors total: 60
#> N predictors per node: 8
#> Average leaves per tree: 4.71
#> Min observations in leaf: 5
#> OOB stat value: 0.90
#> OOB stat type: AUC-ROC
#> Variable importance: anova
#>
#> -----------------------------------------
print(learner$importance())
#> V37 V11 V49 V36 V12 V43 V1
#> 0.37320574 0.35784314 0.35585586 0.32352941 0.29338843 0.28085106 0.27358491
#> V48 V47 V45 V44 V46 V13 V35
#> 0.26339286 0.25742574 0.23502304 0.23243243 0.22624434 0.21875000 0.19911504
#> V51 V21 V17 V10 V52 V57 V20
#> 0.19565217 0.19369369 0.16894977 0.15639810 0.15596330 0.15228426 0.15126050
#> V16 V22 V42 V9 V19 V29 V39
#> 0.15102041 0.13865546 0.13461538 0.13265306 0.12272727 0.12021858 0.10294118
#> V18 V8 V23 V56 V34 V15 V31
#> 0.10047847 0.09401709 0.09170306 0.08571429 0.08520179 0.08520179 0.07851240
#> V40 V50 V58 V53 V54 V38 V28
#> 0.07305936 0.06730769 0.06363636 0.06341463 0.06220096 0.06190476 0.05777778
#> V5 V14 V2 V30 V32 V24 V3
#> 0.05418719 0.05128205 0.05069124 0.04687500 0.04678363 0.04500000 0.04484305
#> V25 V26 V27 V4 V41 V55 V6
#> 0.03773585 0.03720930 0.03669725 0.03608247 0.03478261 0.03043478 0.02739726
#> V59 V33 V7 V60
#> 0.02392344 0.02057613 0.01851852 0.01801802
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2173913