

#Caret models code#
The function bwplot.resamples is used to generate this plot and if you look at the underlying code, the variables are factorized based on their average performance under the metric of interest.īelow I have the relevant code that does the factorization: bwplot.resamples <- function (x, data = NULL, models = x$models, metric = x$metric. Model = factor(model, levels = c("MARS", "CART", "CondInfTree"))) %>% To change the order change the levels of model (this approach also works with ggplot2): resamps$values %>% Scale_y_discrete(limits = c("MARS", "CART", "CondInfTree")) To set a specific order on the y axis: p1 + Geom_boxplot(aes(x = RMSE, y = model)) -> p1 #and plot the box plot Mutate(model = sub("~RMSE", "", model)) %>% #leave just the model names From reissuing design icons to creating future classics in.

Gather(model, RMSE, -1) %>% #convert to long table bridges old and new by creating furniture, lighting and interior objects with timeless appeal. Select(1, ends_with("RMSE")) %>% #select the first column and all columns with a name ending with "RMSE"

Since you did not post an example with data I will use one of the examples from ?caret:::bwplot.resamples library(caret) Bagged Model ( method 'bag' ) For classification and regression using package caret with tuning parameters: Number of Randomly Selected Predictors ( vars ) Bayesian Generalized Linear Model ( method 'bayesglm' ) For classification and regression using package arm with no tuning parameters. This way you will have much better control over the final plot. them through cross-validation, and evaluating the trained models. I recommend plotting the boxplots manually using ggplot2. regression model with caret The caret package is designed for selecting models. Perhaps there is one but my lattice skills are lacking. I am not aware of an easy solution using bwplot method from caret package.
