plot_stability {optRF} | R Documentation |
Plot random forest stability
Description
Plot the estimated stability of random forest against certain numbers of trees
Usage
plot_stability(
optRF_object,
measure = c("selection", "importance", "prediction"),
from = 0,
to = 1e+05,
add.recommendation = TRUE,
add = FALSE,
...
)
Arguments
optRF_object |
An optRF_object, either the result from the opt_importance or the opt_prediction function. |
measure |
A character string indicating which stability measure is to be plotted. One of "selection" (default, visualises selection stability), "prediction" (visualises prediction stability) or "importance" (visualises variable importance stability). |
from |
Smallest num.trees value to be plotted. |
to |
Greatest num.trees value to be plotted. |
add.recommendation |
When set as TRUE, if a recommendation was stated within the opt_prediction or opt_importance function, the recommended num.trees value as well as the expected random forest stability will be highlighted in the graph |
add |
If FALSE, a new plot will be created, if TRUE, the graph will be added to an existing plot. |
... |
Any other arguments from the plot function. |
Value
A plot showing the estimated stability of random forest for the given num.trees values.
Examples
data(SNPdata)
set.seed(123)
result_optpred = opt_prediction(y = SNPdata[,1], X=SNPdata[,-1]) # optimise random forest
plot_stability(result_optpred, measure = "prediction", add.recommendation = TRUE, add=FALSE)
plot_stability(result_optpred, measure = "selection", add.recommendation = FALSE, add=TRUE)