| Title: | Visualisations for Model Ensembles |
|---|---|
| Description: | Displays for model fits of multiple models and their ensembles. For classification models, the plots are heatmaps, for regression, scatterplots. |
| Authors: | Katarina Domijan [aut, cre] (ORCID: <https://orcid.org/0000-0002-4268-2236>) |
| Maintainer: | Katarina Domijan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-05-21 10:09:35 UTC |
| Source: | https://github.com/domijan/ensmodelvis |
Draws a plot for model predictions of ensembles of models. For classification the plot is a heatmap, for regression, scatterplot.
plot_ensemble( truth, tibble_pred, incorrect = FALSE, tibble_prob = NULL, order = NULL, facet = FALSE )plot_ensemble( truth, tibble_pred, incorrect = FALSE, tibble_prob = NULL, order = NULL, facet = FALSE )
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). |
a ggplot
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)))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)))