Description Usage Arguments Details Value Examples
Similar to tuneRF in randomForest
but for ranger
.
1 2 3 4 |
formula |
Object of class formula or character describing the model to fit. Interaction terms supported only for numerical variables. |
data |
Training data of class data.frame, matrix, dgCMatrix (Matrix) or gwaa.data (GenABEL). |
dependent.variable.name |
Name of dependent variable, needed if no formula given. For survival forests this is the time variable. |
mtryStart |
starting value of mtry; default is the same as in |
num.treesTry |
number of trees used at the tuning step |
stepFactor |
at each iteration, mtry is inflated (or deflated) by this value |
improve |
the (relative) improvement in OOB error must be by this much for the search to continue |
trace |
whether to print the progress of the search |
plot |
whether to plot the OOB error as function of mtry |
doBest |
whether to run a forest using the optimal mtry found |
... |
options to be given to |
Provides fast tuning for the mtry hyperparameter.
Starting with the default value of mtry, search for the optimal value (with respect to Out-of-Bag error estimate) of mtry for randomForest.
If doBest=FALSE (default), it returns a matrix whose first column contains the mtry values searched, and the second column the corresponding OOB error.
If doBest=TRUE, it returns the ranger
object produced with the optimal mtry.
1 2 3 4 | library(tuneRanger)
data(iris)
res <- tuneMtryFast(Species ~ ., data = iris, stepFactor = 1.5)
|
Loading required package: ranger
Loading required package: mlrMBO
Loading required package: mlr
Loading required package: ParamHelpers
'mlr' is in maintenance mode since July 2019. Future development
efforts will go into its successor 'mlr3' (<https://mlr3.mlr-org.com>).
Loading required package: smoof
Loading required package: checkmate
Loading required package: parallel
Loading required package: lubridate
Attaching package: ‘lubridate’
The following objects are masked from ‘package:base’:
date, intersect, setdiff, union
Loading required package: lhs
Warning message:
no DISPLAY variable so Tk is not available
mtry = 2 OOB error = 0.05333333
Searching left ...
Searching right ...
mtry = 3 OOB error = 0.04666667
0.125 0.05
mtry = 4 OOB error = 0.05333333
-0.1428571 0.05
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.