Plots the tuning of the hyperparameters num.trees
, mtry
, and min.node.size
performed by rf_tuning()
.
plot_tuning(
model,
point.color = viridis::viridis(
100,
option = "F"
),
verbose = TRUE
)
A model fitted with rf_tuning()
. Default: NULL
Colors of the plotted points. Can be a single color name (e.g. "red4"), a character vector with hexadecimal codes (e.g. "#440154FF" "#21908CFF" "#FDE725FF"), or function generating a palette (e.g. viridis::viridis(100)
). Default: viridis::viridis(100, option = "F")
Logical, if TRUE
, the plot is printed. Default: TRUE
A ggplot.
if(interactive()){
#load example data
data(plant_richness_df)
#fit random forest model
rf.model <- rf(
data = plant_richness_df,
dependent.variable.name = "richness_species_vascular",
predictor.variable.names = colnames(plant_richness_df)[5:21],
distance.matrix = distance_matrix,
distance.thresholds = 0,
n.cores = 1,
verbose = FALSE
)
#tune random forest model
rf.model <- rf_tuning(
model = rf.model,
xy = plant_richness_df[, c("x", "y")],
n.cores = 1,
verbose = FALSE
)
#generate tuning plot
plot_tuning(model = rf.model)
}