The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Visualisations for Model Ensembles
Version: 0.2.0
Description: Displays for model fits of multiple models and their ensembles. For classification models, the plots are heatmaps, for regression, scatterplots.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Depends: R (≥ 4.1.0)
Imports: dplyr, forcats, ggplot2, rlang, tidyr
URL: https://github.com/domijan/ensModelVis
BugReports: https://github.com/domijan/ensModelVis/issues
Suggests: discrim, glmnet, kernlab, knitr, MASS, nnet, ranger, rmarkdown, stacks, stringr, tidymodels
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-01-14 22:56:00 UTC; katarina
Author: Katarina Domijan ORCID iD [aut, cre]
Maintainer: Katarina Domijan <domijank@tcd.ie>
Repository: CRAN
Date/Publication: 2026-01-20 10:30:07 UTC

Draws a plot for model predictions of ensembles of models. For classification the plot is a heatmap, for regression, scatterplot.

Description

Draws a plot for model predictions of ensembles of models. For classification the plot is a heatmap, for regression, scatterplot.

Usage

plot_ensemble(
  truth,
  tibble_pred,
  incorrect = FALSE,
  tibble_prob = NULL,
  order = NULL,
  facet = FALSE
)

Arguments

truth

The y variable. In regression this is numeric vector, in classification this is a factor vector.

tibble_pred

A data.frame of predictions. Each column corresponds to a candidate model.

incorrect

If TRUE, for observations that were correctly classified by all models, remove all but a single observation per class. Classification only.

tibble_prob

If not NULL, a data.frame with same column names as tibble_pred. Applies transparency based on the predicted probability of the predicted class. Classification only.

order

default ordering of columns in a heatmap (classification) or facets (regression) is by accuracy (classification) or RMSE (regression). Can submit any other ordering for heatmaps e.g. AUC, which should be a data.frame with same column names as tibble_pred.

facet

whether to facet the plots by model (regression only).

Value

a ggplot

Examples

data(iris)
if (require("MASS")){
lda.model <- lda(Species~., data = iris)
lda.pred <- predict(lda.model)
}
if (require("ranger")){
ranger.model <- ranger(Species~., data = iris)
ranger.pred <- predict(ranger.model, iris)
}

library(ensModelVis)

plot_ensemble(iris$Species,
data.frame(LDA = lda.pred$class,
RF = ranger.pred$predictions))

plot_ensemble(iris$Species,
 data.frame(LDA = lda.pred$class,
  RF = ranger.pred$predictions),
  incorrect= TRUE)

if (require("ranger")){
ranger.model <- ranger(Species~., data = iris, probability = TRUE)
ranger.prob <- predict(ranger.model, iris)
}

plot_ensemble(iris$Species,
  data.frame(LDA = lda.pred$class,
   RF = ranger.pred$predictions),
   tibble_prob = data.frame(LDA = apply(lda.pred$posterior, 1, max),
   RF = apply(ranger.prob$predictions, 1, max)))

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.