Compare validation and test error
val_vs_test.Rd
Plot validation error against test error for a list of models.
Usage
val_vs_test(
model_list,
data,
error_fun,
regex1 = NULL,
regex2 = NULL,
name1 = NULL,
name2 = NULL,
legendtitle1 = "spot 1",
legendtitle2 = "spot 2",
correlation_label = TRUE,
file = NULL,
return_type = c("ggplot", "tibble"),
plot_theme = ggplot2::theme_minimal(),
colors = NULL,
width = 7,
height = 4,
quiet = FALSE
)
Arguments
- model_list
list of
Model
objects.- data
Data
object. Itscohort
attribute must be set. Calculate the test error on thecohort
ofdata
.- error_fun
function. Error function to calculate the error between the true and predicted response. For its interface, see
val_error_fun_prototype()
.- regex1
character vector. Regular-expression patterns. For every model, we assign it the group in
name1
corresponding to the first pattern its name matches and color it accordingly.- regex2
character vector. Regular-expression patterns. For every model, we assign it the group in
name2
corresponding to the first pattern its name matches and shape it accordingly.- name1, name2
character vectors. Names of the groups as defined via
regex1
andregex2
. Therefore,length(name1) == length(regex1)
andlength(name2) == length(regex2)
. Ifname1
orname2
isNULL
, we use the correspondingregex1
orregex2
as the name.- legendtitle1, legendtitle2
string. Legend titles for the grouping according to
regex1
andregex2
.- correlation_label
logical. Whether to show the correlation coefficient between the validation and test error as a label in the plot.
- file
string. File name to save the plot to.
- return_type
string. Either "ggplot" or "tibble". See return section for details.
- plot_theme
ggplot2 theme. Theme to apply to the plot. If it's
NULL
, use the ggplot2 default theme.- colors
character vector. Colors used for points.
- width, height
numeric. Width and height of the stored plot in inches.
- quiet
logical. Whether to suppress messages.