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 behavior 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/chapters/chapter2/data_and_basic_modeling.html#sec-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()
LearnerClassifObliqueRandomForest$oob_error()
OOB concordance error extracted from the model slot
eval_oobag$stat_values
LearnerClassifObliqueRandomForest$importance()
The importance scores are extracted from the model.
Returns
Named numeric().
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', 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)
#> ---------- 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: 5.126
#> Min observations in leaf: 5
#> OOB stat value: 0.88
#> OOB stat type: AUC-ROC
#> Variable importance: anova
#>
#> -----------------------------------------
print(learner$importance())
#> V11 V10 V49 V12 V13 V9 V37
#> 0.45454545 0.34722222 0.32173913 0.31223629 0.30909091 0.26976744 0.25471698
#> V21 V48 V36 V51 V4 V20 V52
#> 0.24637681 0.23109244 0.22943723 0.21904762 0.19634703 0.19512195 0.17073171
#> V22 V45 V27 V47 V28 V31 V19
#> 0.16326531 0.16129032 0.14634146 0.13888889 0.13502110 0.13362069 0.13089005
#> V46 V16 V35 V5 V8 V26 V23
#> 0.12440191 0.12307692 0.12195122 0.11946903 0.10169492 0.10126582 0.09821429
#> V1 V17 V34 V15 V44 V18 V54
#> 0.09734513 0.08762887 0.08675799 0.08597285 0.08510638 0.07949791 0.07818930
#> V43 V6 V14 V38 V50 V3 V57
#> 0.07446809 0.06896552 0.06698565 0.06666667 0.06161137 0.06147541 0.06086957
#> V2 V40 V30 V58 V32 V53 V33
#> 0.05907173 0.05855856 0.04500000 0.04411765 0.04128440 0.03734440 0.03703704
#> V55 V59 V29 V39 V41 V7 V42
#> 0.03669725 0.03465347 0.03349282 0.03139013 0.03111111 0.02777778 0.02678571
#> V25 V24 V56 V60
#> 0.02222222 0.02212389 0.01851852 0.01401869
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2028986