| 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 |
| 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 |
tibble_pred |
A |
incorrect |
If |
tibble_prob |
If not |
order |
default ordering of columns in a heatmap (classification) or facets (regression) is by |
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)))