Skip to content

Commit

Permalink
Force matrix for cumulative (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymiuks authored Nov 30, 2023
1 parent 28896b7 commit d4f6289
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: iBreakDown
Title: Model Agnostic Instance Level Variable Attributions
Version: 2.1.1
Version: 2.1.2
Authors@R: c(person("Przemyslaw", "Biecek", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8423-1823")),
person("Alicja", "Gosiewska", role = "aut",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
iBreakDown 2.1.2
---------------------------------------------------------------
* force matrix class for cumulative contributions in the calculate_contributions_along_path to prevent iBreakDown breaking for multiclass classification
models that return data.frame of probabilities instead of a matrix.

iBreakDown 2.1.1
---------------------------------------------------------------
* consistent theme settings with [#541](https://github.com/ModelOriented/DALEX/issues/541)
Expand Down
2 changes: 1 addition & 1 deletion R/local_attributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ calculate_contributions_along_path <- function(x,
variable <- c("intercept",
paste0(colnames(current_data)[selected$ind1], " = ", selected_values) ,
"prediction")
cumulative <- do.call(rbind, c(list(baseline_yhat), yhats_mean, list(target_yhat)))
cumulative <- as.matrix(do.call(rbind, c(list(baseline_yhat), yhats_mean, list(target_yhat))))
contribution <- rbind(0,apply(cumulative, 2, diff))
contribution[1,] <- cumulative[1,]
contribution[nrow(contribution),] <- cumulative[nrow(contribution),]
Expand Down

0 comments on commit d4f6289

Please sign in to comment.