diff --git a/DESCRIPTION b/DESCRIPTION index 2f461151..69ed6e78 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: DALEX Title: moDel Agnostic Language for Exploration and eXplanation -Version: 2.5.1 +Version: 2.5.2 Authors@R: c(person("Przemyslaw", "Biecek", email = "przemyslaw.biecek@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8423-1823")), person("Szymon", "Maksymiuk", role = "aut", @@ -22,7 +22,7 @@ Description: Any unverified black box model is the path to failure. Opaqueness l License: GPL Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Depends: R (>= 3.5) Imports: ggplot2, diff --git a/NEWS.md b/NEWS.md index f0cca477..48a86f92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +DALEX 2.5.2 +--------------------------------------------------------------- +* Fix wrong row order in the `plot.model_performance` ([#49](https://github.com/ModelOriented/DALEX/issues/49)) + DALEX 2.5.1 --------------------------------------------------------------- * adding the support for calculating kernel SHAP values via `predict_parts()` function diff --git a/R/plot_model_performance.R b/R/plot_model_performance.R index db82e078..8286e6cb 100644 --- a/R/plot_model_performance.R +++ b/R/plot_model_performance.R @@ -8,6 +8,9 @@ #' @param show_outliers number of largest residuals to be presented (only when geom = boxplot). #' @param ptlabel either \code{"name"} or \code{"index"} determines the naming convention of the outliers #' +#' @details +#' Whenever multiple explainers are provided using ellipsis, they are sorted based on their labels levels. +#' #' @return An object of the class \code{model_performance}. #' #' @export @@ -80,6 +83,9 @@ plot.model_performance <- function(x, ..., geom = "ecdf", show_outliers = 0, ptl } df$label <- reorder(df$label, df$diff, loss_function) + # Sort df based on the label's levels to make sure downstream functions relying + # on the rows order work appropriately + df <- df[order(df$label), ] if (ptlabel == "name") { df$name <- NULL df$name <- rownames(df) diff --git a/man/plot.model_performance.Rd b/man/plot.model_performance.Rd index f6e063a2..820e9c37 100644 --- a/man/plot.model_performance.Rd +++ b/man/plot.model_performance.Rd @@ -35,6 +35,9 @@ An object of the class \code{model_performance}. \description{ Plot Dataset Level Model Performance Explanations } +\details{ +Whenever multiple explainers are provided using ellipsis, they are sorted based on their labels levels. +} \examples{ \donttest{ library("ranger")