Skip to content

Take unique() of add_vars, x, and y #116

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

Merged
merged 1 commit into from
Oct 20, 2023
Merged
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- `print.shapviz()` now shows top two rows of SHAP matrix.
- Re-activate all unit tests.
- Added "How to contribute" to README.
- `sv_dependence2D()`: In case `add_vars` are passed, `x` and/or `y` are removed from it in order to not use any variable twice.

# shapviz 0.9.2

Expand Down
5 changes: 3 additions & 2 deletions R/sv_dependence2D.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#' maybe other regional features that can be passed via `add_vars`).
#'
#' If SHAP interaction values are available, setting `interactions = TRUE` allows
#' to focus on pure interaction effects (multiplied by two).
#' to focus on pure interaction effects (multiplied by two). In this case, `add_vars`
#' has no effect.
#'
#' @importFrom rlang .data
#'
Expand Down Expand Up @@ -114,7 +115,7 @@ sv_dependence2D.shapviz <- function(object, x, y,

# Color variable
if (!interactions) {
s <- rowSums(S[, c(x, y, add_vars)])
s <- rowSums(S[, unique(c(x, y, add_vars))]) # unique() if add_vars contains x or y
} else {
s <- S_inter[, x, y]
if (x != y) {
Expand Down
3 changes: 2 additions & 1 deletion man/sv_dependence2D.Rd

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