Skip to content

Commit

Permalink
Merge pull request #52 from mayer79/cran_050
Browse files Browse the repository at this point in the history
prepare CRAN submission
  • Loading branch information
mayer79 committed Feb 3, 2023
2 parents 5e7f4ad + f5f1e57 commit bd7b25f
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 19 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.4.1
Date: 2023-01-11 17:58:30 UTC
SHA: 68d9a2c4c60680dcd8df2ed5c5bfd01c395a6059
Version: 0.5.0
Date: 2023-02-03 11:14:39 UTC
SHA: 097dce7331a12179ae5b45a869627f3d49efffc7
2 changes: 1 addition & 1 deletion R/shapviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ shapviz.matrix = function(object, X, baseline = 0, collapse = NULL,
#' @examples
#' X_pred <- data.matrix(iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#'
#' # Will use numeric matrix "X_pred" as feature matrix
#' x <- shapviz(fit, X_pred = X_pred)
Expand Down
2 changes: 1 addition & 1 deletion R/sv_dependence.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#' @seealso \code{\link{potential_interactions}}
#' @examples
#' dtrain <- xgboost::xgb.DMatrix(data.matrix(iris[, -1]), label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#' x <- shapviz(fit, X_pred = dtrain, X = iris)
#' sv_dependence(x, "Petal.Length")
#' sv_dependence(x, "Petal.Length", color_var = "Species")
Expand Down
2 changes: 1 addition & 1 deletion R/sv_force.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @seealso \code{\link{sv_waterfall}}
#' @examples
#' dtrain <- xgboost::xgb.DMatrix(data.matrix(iris[, -1]), label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#' x <- shapviz(fit, X_pred = dtrain, X = iris[, -1])
#' sv_force(x)
#' sv_force(x, row_id = 65, max_display = 3, size = 9, fill_colors = 4:5)
Expand Down
2 changes: 1 addition & 1 deletion R/sv_importance.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#' @examples
#' X_train <- data.matrix(iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_train, label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#' x <- shapviz(fit, X_pred = X_train)
#' sv_importance(x)
#' sv_importance(x, kind = "beeswarm", show_numbers = TRUE)
Expand Down
7 changes: 5 additions & 2 deletions R/sv_interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @export
#' @examples
#' dtrain <- xgboost::xgb.DMatrix(data.matrix(iris[, -1]), label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#' x <- shapviz(fit, X_pred = dtrain, X = iris, interactions = TRUE)
#' sv_interaction(x)
#' sv_interaction(x, max_display = 2, size = 3, alpha = 0.1)
Expand Down Expand Up @@ -61,7 +61,10 @@ sv_interaction.shapviz <- function(object, kind = c("beeswarm", "no"),
ord <- names(.get_imp(get_shap_values(object)))

if (kind == "no") {
return(apply(abs(S_inter), 2:3, mean)[ord, ord])
mat <- apply(abs(S_inter), 2:3, mean)[ord, ord]
off_diag <- row(mat) != col(mat)
mat[off_diag] <- mat[off_diag] * 2 # compensate symmetry
return(mat)
}

if (ncol(S_inter) > max_display) {
Expand Down
2 changes: 1 addition & 1 deletion R/sv_waterfall.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#' @seealso \code{\link{sv_force}}
#' @examples
#' dtrain <- xgboost::xgb.DMatrix(data.matrix(iris[, -1]), label = iris[, 1])
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 50, nthread = 1)
#' x <- shapviz(fit, X_pred = dtrain, X = iris[, -1])
#' sv_waterfall(x)
#' sv_waterfall(x, row_id = 123, max_display = 2, size = 9, fill_colors = 4:5)
Expand Down
18 changes: 15 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Submission of shapviz 0.5.0
# Re-Submission of shapviz 0.5.0

A pre-check failed:

```
Examples with CPU time > 2.5 times elapsed time
user system elapsed ratio
sv_dependence 1.268 0.032 0.472 2.754
```

I have now set the parameter `nthread = 1` in fitting the XGBoost models in the
examples, hoping to solve that issue.

## Original message

Dear CRAN team. "shapviz" now offers plots for SHAP interaction values - a feature that was on the wishlist for quite some time.

Expand All @@ -11,8 +24,6 @@ Dear CRAN team. "shapviz" now offers plots for SHAP interaction values - a featu

### check_rhub()

Winbuilder: Status: OK

rhub notes

NOTES:
Expand All @@ -25,3 +36,4 @@ Found the following files/directories:

### check_win_devel()

winbuilder: Status: OK
2 changes: 1 addition & 1 deletion man/shapviz.Rd

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

2 changes: 1 addition & 1 deletion man/sv_dependence.Rd

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

2 changes: 1 addition & 1 deletion man/sv_force.Rd

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

2 changes: 1 addition & 1 deletion man/sv_importance.Rd

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

2 changes: 1 addition & 1 deletion man/sv_interaction.Rd

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

2 changes: 1 addition & 1 deletion man/sv_waterfall.Rd

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

0 comments on commit bd7b25f

Please sign in to comment.