Tuning the parameters of the alpha-RF {CompositionalML} | R Documentation |
Tuning the parameters of the \alpha
-RF
Description
Tuning the parameters of the \alpha
-RF.
Usage
alfarf.tune(y, x, a = seq(-1, 1, by = 0.1), size = c(1, 2, 3),
depth = c(0, 1), splits = 2:5, R = 500, ncores = 1, folds = NULL,
nfolds = 10, stratified = TRUE, seed = NULL, graph = FALSE)
Arguments
y |
The response variable, it can either be a factor (for classification) or a numeric vector (for regression). Depending on the nature of the response variable, the function will proceed with the necessary task. |
x |
A matrix with the compositional data. |
a |
A vector with a grid of values of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If a=0, the isometric log-ratio transformation is applied. |
size |
The minimal node size to split at. |
depth |
The maximal tree depth. A value of NULL or 0 corresponds to unlimited depth, 1 to tree stumps (1 split per tree). |
splits |
The number of random splits to consider for each candidate splitting variable. |
R |
The number of trees. |
ncores |
The number of cores to use. If more than 1, parallel computing will take place. It is advisable to use it if you have many observations and or many variables, otherwise it will slow down the process. |
folds |
If you have the list with the folds supply it here. You can also leave it NULL and it will create folds. |
nfolds |
The number of folds in the cross validation. |
stratified |
Do you want the folds to be created in a stratified way? TRUE or FALSE. |
seed |
You can specify your own seed number here or leave it NULL. |
graph |
If graph is TRUE (default value) a plot will appear. |
Details
K-fold cross-validation of the \alpha
-RF with compositional predictor
variables is performed to select the optimal value of \alpha
and the optimal
configutrations of the random forest (RF).
Value
If graph is true, a graph with the estimated performance for each value of \alpha
.
A list including:
per |
A vector with the estimated performance for each value of |
performance |
A vector with the optimal performance and the optimal combinations of the hyper-parameters of the RF. |
best_a |
The value of |
runtime |
The time required by the cross-validation procedure. |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Wright M. N. and Ziegler A. (2017). ranger: A fast implementation of random forests for high dimensional data in C++ and R. Journal of Statisrical Software 77:1-17. doi:10.18637/jss.v077.i01.
Friedman Jerome, Trevor Hastie and Robert Tibshirani (2009). The elements of statistical learning, 2nd edition. Springer, Berlin.
Tsagris M.T., Preston S. and Wood A.T.A. (2011). A data-based power transformation for compositional data. In Proceedings of the 4th Compositional Data Analysis Workshop, Girona, Spain. https://arxiv.org/pdf/1106.1451.pdf
See Also
Examples
x <- as.matrix(iris[, 1:4])
x <- x/ rowSums(x)
y <- iris[, 5]
mod <- alfa.rf(x, y, x, a = c(0, 0.5, 1), size = 3, depth = 1, splits = 2:3, R = 500)
mod