Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong row order in the plot.model_performance #567

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8423-1823")),
person("Szymon", "Maksymiuk", role = "aut",
Expand All @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions R/plot_model_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions man/plot.model_performance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading