diff --git a/NEWS.md b/NEWS.md
index 1078da5..d20b0ed 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -7,6 +7,7 @@
### Compatibility
+- Adapt for upcoming {xgboost} version.
- Adapt for upcoming {shapr} version, thanks @martinju for the fix [#162](https://github.com/ModelOriented/shapviz/pull/162).
# shapviz 0.9.6
diff --git a/R/shapviz.R b/R/shapviz.R
index 41364eb..c8832f9 100644
--- a/R/shapviz.R
+++ b/R/shapviz.R
@@ -116,7 +116,7 @@ shapviz.matrix = function(
#' # XGBoost models
#' X_pred <- data.matrix(iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1], nthread = 1)
-#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
+#' fit <- xgboost::xgb.train(list(nthread = 1), data = dtrain, nrounds = 10)
#'
#' # Will use numeric matrix "X_pred" as feature matrix
#' x <- shapviz(fit, X_pred = X_pred)
@@ -131,12 +131,12 @@ shapviz.matrix = function(
#' x <- shapviz(fit, X_pred = dtrain, X = iris)
#'
#' # Multiclass setting
-#' params <- list(objective = "multi:softprob", num_class = 3)
+#' params <- list(objective = "multi:softprob", num_class = 3, nthread = 1)
#' X_pred <- data.matrix(iris[, -5])
#' dtrain <- xgboost::xgb.DMatrix(
#' X_pred, label = as.integer(iris[, 5]) - 1, nthread = 1
#' )
-#' fit <- xgboost::xgb.train(params = params, data = dtrain, nrounds = 10, nthread = 1)
+#' fit <- xgboost::xgb.train(params = params, data = dtrain, nrounds = 10)
#'
#' # Select specific class
#' x <- shapviz(fit, X_pred = X_pred, which_class = 3)
@@ -149,7 +149,7 @@ shapviz.matrix = function(
#' # What if we would have one-hot-encoded values and want to explain the original column?
#' X_pred <- stats::model.matrix(~ . -1, iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_pred, label = as.integer(iris[, 1]), nthread = 1)
-#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
+#' fit <- xgboost::xgb.train(list(nthread = 1), data = dtrain, nrounds = 10)
#' x <- shapviz(
#' fit,
#' X_pred = X_pred,
diff --git a/cran-comments.md b/cran-comments.md
index 9d569a3..d25fd80 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1,6 +1,6 @@
-# shapviz 0.9.6 (Fix CRAN errors)
+# shapviz 0.9.7
-One vignette points to a missing figure, leading errors or notes in different builds.
+Slight adaptions to comply with upcoming XGBoost version.
### Local checks
@@ -12,4 +12,5 @@ Status: OK
## Reverse dependencies (2)
-Not checked because the change affects only a vignette.
+OK: 2
+BROKEN: 0
diff --git a/man/shapviz.Rd b/man/shapviz.Rd
index eb48326..61080b0 100644
--- a/man/shapviz.Rd
+++ b/man/shapviz.Rd
@@ -190,7 +190,7 @@ shapviz(S, X, baseline = 4)
# XGBoost models
X_pred <- data.matrix(iris[, -1])
dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1], nthread = 1)
-fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
+fit <- xgboost::xgb.train(list(nthread = 1), data = dtrain, nrounds = 10)
# Will use numeric matrix "X_pred" as feature matrix
x <- shapviz(fit, X_pred = X_pred)
@@ -205,12 +205,12 @@ sv_dependence(x, "Species")
x <- shapviz(fit, X_pred = dtrain, X = iris)
# Multiclass setting
-params <- list(objective = "multi:softprob", num_class = 3)
+params <- list(objective = "multi:softprob", num_class = 3, nthread = 1)
X_pred <- data.matrix(iris[, -5])
dtrain <- xgboost::xgb.DMatrix(
X_pred, label = as.integer(iris[, 5]) - 1, nthread = 1
)
-fit <- xgboost::xgb.train(params = params, data = dtrain, nrounds = 10, nthread = 1)
+fit <- xgboost::xgb.train(params = params, data = dtrain, nrounds = 10)
# Select specific class
x <- shapviz(fit, X_pred = X_pred, which_class = 3)
@@ -223,7 +223,7 @@ x
# What if we would have one-hot-encoded values and want to explain the original column?
X_pred <- stats::model.matrix(~ . -1, iris[, -1])
dtrain <- xgboost::xgb.DMatrix(X_pred, label = as.integer(iris[, 1]), nthread = 1)
-fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
+fit <- xgboost::xgb.train(list(nthread = 1), data = dtrain, nrounds = 10)
x <- shapviz(
fit,
X_pred = X_pred,
diff --git a/revdep/README.md b/revdep/README.md
index 423bf6f..73c4ce9 100644
--- a/revdep/README.md
+++ b/revdep/README.md
@@ -1,53 +1,53 @@
# Platform
-|field |value |
-|:--------|:----------------------------------------|
-|version |R version 4.4.1 (2024-06-14 ucrt) |
-|os |Windows 11 x64 (build 22631) |
-|system |x86_64, mingw32 |
-|ui |RStudio |
-|language |(EN) |
-|collate |English_Switzerland.utf8 |
-|ctype |English_Switzerland.utf8 |
-|tz |Europe/Zurich |
-|date |2024-09-13 |
-|rstudio |2024.04.2+764 Chocolate Cosmos (desktop) |
-|pandoc |NA |
+|field |value |
+|:--------|:-------------------------------------|
+|version |R version 4.4.1 (2024-06-14 ucrt) |
+|os |Windows 11 x64 (build 22631) |
+|system |x86_64, mingw32 |
+|ui |RStudio |
+|language |(EN) |
+|collate |English_Switzerland.utf8 |
+|ctype |English_Switzerland.utf8 |
+|tz |Europe/Zurich |
+|date |2025-01-19 |
+|rstudio |2024.12.0+467 Kousa Dogwood (desktop) |
+|pandoc |NA |
# Dependencies
|package |old |new |Δ |
|:------------|:-------|:-------|:--|
-|shapviz |0.9.4 |0.9.5 |* |
+|shapviz |0.9.6 |0.9.7 |* |
|cli |3.6.3 |3.6.3 | |
|colorspace |2.1-1 |2.1-1 | |
-|commonmark |1.9.1 |1.9.1 | |
-|curl |5.2.2 |5.2.2 | |
-|data.table |1.16.0 |1.16.0 | |
+|commonmark |1.9.2 |1.9.2 | |
+|curl |6.1.0 |6.1.0 | |
+|data.table |1.16.4 |1.16.4 | |
|fansi |1.0.6 |1.0.6 | |
|farver |2.1.2 |2.1.2 | |
|ggfittext |0.10.2 |0.10.2 | |
|gggenes |0.5.1 |0.5.1 | |
|ggplot2 |3.5.1 |3.5.1 | |
|ggrepel |0.9.6 |0.9.6 | |
-|glue |1.7.0 |1.7.0 | |
+|glue |1.8.0 |1.8.0 | |
|gridtext |0.1.5 |0.1.5 | |
-|gtable |0.3.5 |0.3.5 | |
+|gtable |0.3.6 |0.3.6 | |
|isoband |0.2.7 |0.2.7 | |
|jpeg |0.1-10 |0.1-10 | |
-|jsonlite |1.8.8 |1.8.8 | |
+|jsonlite |1.8.9 |1.8.9 | |
|labeling |0.4.3 |0.4.3 | |
|lifecycle |1.0.4 |1.0.4 | |
|magrittr |2.0.3 |2.0.3 | |
|markdown |1.13 |1.13 | |
|munsell |0.5.1 |0.5.1 | |
-|patchwork |1.2.0 |1.2.0 | |
-|pillar |1.9.0 |1.9.0 | |
+|patchwork |1.3.0 |1.3.0 | |
+|pillar |1.10.1 |1.10.1 | |
|pkgconfig |2.0.3 |2.0.3 | |
|png |0.1-8 |0.1-8 | |
|R6 |2.5.1 |2.5.1 | |
|RColorBrewer |1.1-3 |1.1-3 | |
-|Rcpp |1.0.13 |1.0.13 | |
+|Rcpp |1.0.14 |1.0.14 | |
|rlang |1.1.4 |1.1.4 | |
|scales |1.3.0 |1.3.0 | |
|shades |1.4.0 |1.4.0 | |
@@ -57,17 +57,10 @@
|utf8 |1.2.4 |1.2.4 | |
|vctrs |0.6.5 |0.6.5 | |
|viridisLite |0.4.2 |0.4.2 | |
-|withr |3.0.1 |3.0.1 | |
-|xfun |0.47 |0.47 | |
+|withr |3.0.2 |3.0.2 | |
+|xfun |0.50 |0.50 | |
|xgboost |1.7.8.1 |1.7.8.1 | |
|xml2 |1.3.6 |1.3.6 | |
# Revdeps
-## Failed to check (2)
-
-|package |version |error |warning |note |
-|:--------|:-------|:-----|:-------|:----|
-|fastshap |0.1.1 |1 | |2 |
-|flowml |? | | | |
-
diff --git a/revdep/cran.md b/revdep/cran.md
index e8913a8..d07935b 100644
--- a/revdep/cran.md
+++ b/revdep/cran.md
@@ -1,12 +1,7 @@
## revdepcheck results
-We checked 2 reverse dependencies (1 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
+We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
* We saw 0 new problems
- * We failed to check 1 packages
+ * We failed to check 0 packages
-Issues with CRAN packages are summarised below.
-
-### Failed to check
-
-* fastshap (NA)
diff --git a/revdep/failures.md b/revdep/failures.md
index 41a2ac1..9a20736 100644
--- a/revdep/failures.md
+++ b/revdep/failures.md
@@ -1,142 +1 @@
-# fastshap
-
-
-
-* Version: 0.1.1
-* GitHub: https://github.com/bgreenwell/fastshap
-* Source code: https://github.com/cran/fastshap
-* Date/Publication: 2024-02-22 22:00:02 UTC
-* Number of recursive dependencies: 90
-
-Run `revdepcheck::revdep_details(, "fastshap")` for more info
-
-
-
-## In both
-
-* R CMD check timed out
-
-
-* checking package dependencies ... NOTE
- ```
- Package which this enhances but not available for checking: 'lightgbm'
- ```
-
-* checking Rd cross-references ... NOTE
- ```
- Package unavailable to check Rd xrefs: 'lightgbm'
- ```
-
-# flowml
-
-
-
-* Version:
-* GitHub: https://github.com/ModelOriented/shapviz
-* Source code: NA
-* Number of recursive dependencies: 0
-
-
-
-## Error before installation
-
-### Devel
-
-```
-
- There are binary versions available but the source versions are later:
- binary source needs_compilation
-abind 1.4-5 1.4-8 FALSE
-gam 1.22-4 1.22-5 TRUE
-ps 1.7.7 1.8.0 TRUE
-RcppArmadillo 14.0.0-1 14.0.2-1 TRUE
-
- Binaries will be installed
-package 'ABCanalysis' successfully unpacked and MD5 sums checked
-...
-package 'pls' successfully unpacked and MD5 sums checked
-package 'plyr' successfully unpacked and MD5 sums checked
-package 'png' successfully unpacked and MD5 sums checked
-package 'prettyunits' successfully unpacked and MD5 sums checked
-package 'pROC' successfully unpacked and MD5 sums checked
-package 'processx' successfully unpacked and MD5 sums checked
-package 'prodlim' successfully unpacked and MD5 sums checked
-package 'progress' successfully unpacked and MD5 sums checked
-package 'progressr' successfully unpacked and MD5 sums checked
-package 'promises' successfully unpacked and MD5 sums checked
-
-
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/experiment/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/windows/contrib/4.4/PACKAGES'
-...
-2: In download.file(url, destfile, method, mode = "wb", ...) :
- downloaded length 247004746 != reported length 266665380
-3: In download.file(url, destfile, method, mode = "wb", ...) :
- URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/h2o_3.44.0.3.zip': Timeout of 60 seconds was reached
-4: In download.file(url, destfile, method, mode = "wb", ...) :
- URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/h2o_3.44.0.3.zip': Timeout of 60 seconds was reached
-Warning in download.packages(pkgs, destdir = tmpd, available = available, :
- download of package 'h2o' failed
-Warning in download.packages(pkgs, destdir = tmpd, available = available, :
- download of package 'h2o' failed
-
-
-```
-### CRAN
-
-```
-
- There are binary versions available but the source versions are later:
- binary source needs_compilation
-abind 1.4-5 1.4-8 FALSE
-gam 1.22-4 1.22-5 TRUE
-ps 1.7.7 1.8.0 TRUE
-RcppArmadillo 14.0.0-1 14.0.2-1 TRUE
-
- Binaries will be installed
-package 'ABCanalysis' successfully unpacked and MD5 sums checked
-...
-package 'pls' successfully unpacked and MD5 sums checked
-package 'plyr' successfully unpacked and MD5 sums checked
-package 'png' successfully unpacked and MD5 sums checked
-package 'prettyunits' successfully unpacked and MD5 sums checked
-package 'pROC' successfully unpacked and MD5 sums checked
-package 'processx' successfully unpacked and MD5 sums checked
-package 'prodlim' successfully unpacked and MD5 sums checked
-package 'progress' successfully unpacked and MD5 sums checked
-package 'progressr' successfully unpacked and MD5 sums checked
-package 'promises' successfully unpacked and MD5 sums checked
-
-
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/bioc/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/windows/contrib/4.4/PACKAGES'
-Warning: unable to access index for repository https://bioconductor.org/packages/3.18/data/experiment/bin/windows/contrib/4.4:
- cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/windows/contrib/4.4/PACKAGES'
-...
-2: In download.file(url, destfile, method, mode = "wb", ...) :
- downloaded length 247004746 != reported length 266665380
-3: In download.file(url, destfile, method, mode = "wb", ...) :
- URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/h2o_3.44.0.3.zip': Timeout of 60 seconds was reached
-4: In download.file(url, destfile, method, mode = "wb", ...) :
- URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/h2o_3.44.0.3.zip': Timeout of 60 seconds was reached
-Warning in download.packages(pkgs, destdir = tmpd, available = available, :
- download of package 'h2o' failed
-Warning in download.packages(pkgs, destdir = tmpd, available = available, :
- download of package 'h2o' failed
-
-
-```
+*Wow, no problems at all. :)*
\ No newline at end of file
diff --git a/shapviz.Rproj b/shapviz.Rproj
index 497f8bf..19c4c75 100644
--- a/shapviz.Rproj
+++ b/shapviz.Rproj
@@ -1,4 +1,5 @@
Version: 1.0
+ProjectId: 53532cda-0245-4018-9318-405db5e4b62a
RestoreWorkspace: Default
SaveWorkspace: Default
diff --git a/tests/testthat/test-interface.R b/tests/testthat/test-interface.R
index 057b7a2..41202ae 100644
--- a/tests/testthat/test-interface.R
+++ b/tests/testthat/test-interface.R
@@ -261,11 +261,9 @@ test_that("combining incompatible shapviz objects fails", {
X_pred <- data.matrix(iris[, -5L])
dtrain <- xgboost::xgb.DMatrix(X_pred, label = as.integer(iris[, 5L]) - 1L, nthread = 1)
fit <- xgboost::xgb.train(
- params = list(nthread = 1L),
+ params = list(nthread = 1L, num_class = 3L, objective = "multi:softprob"),
data = dtrain,
- nrounds = 1L,
- objective="multi:softprob",
- num_class = 3L
+ nrounds = 1L
)
shp3 <- shapviz(fit, X_pred = X_pred, which_class = 3L, interactions = TRUE)
mshp <- shapviz(fit, X_pred = X_pred, interactions = TRUE)