Skip to content

Commit 8e4c726

Browse files
authored
Merge pull request #132 from ModelOriented/cran-1
CRAN Release
2 parents 1e39218 + b97d7a9 commit 8e4c726

18 files changed

+41
-101
lines changed

CRAN-SUBMISSION

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 0.9.2
2-
Date: 2023-10-14 16:44:29 UTC
3-
SHA: 1d239694c309c6b48168b2ca19b8fd5c8d6f1d2d
1+
Version: 0.9.3
2+
Date: 2024-01-12 11:21:47 UTC
3+
SHA: d2f329e540177df778e787a27dec50d34cb5ed5c

R/shapviz.R

-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ shapviz.matrix = function(object, X, baseline = 0, collapse = NULL,
111111
#' Creates a "shapviz" object from an XGBoost model.
112112
#' @export
113113
#' @examples
114-
#' \dontrun{
115114
#' # XGBoost models
116115
#' X_pred <- data.matrix(iris[, -1])
117116
#' dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1], nthread = 1)
@@ -184,7 +183,6 @@ shapviz.matrix = function(object, X, baseline = 0, collapse = NULL,
184183
#' mx
185184
#' all.equal(mx[[3]], x)
186185
#' }
187-
#' }
188186
shapviz.xgb.Booster = function(object, X_pred, X = X_pred, which_class = NULL,
189187
collapse = NULL, interactions = FALSE, ...) {
190188
stopifnot(

R/sv_dependence.R

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#' @param ... Arguments passed to [ggplot2::geom_jitter()].
4040
#' @returns An object of class "ggplot" (or "patchwork") representing a dependence plot.
4141
#' @examples
42-
#' \dontrun{
4342
#' dtrain <- xgboost::xgb.DMatrix(
4443
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
4544
#' )
@@ -57,7 +56,6 @@
5756
#' sv_dependence(
5857
#' x2, c("Petal.Length", "Species"), color_var = NULL, interactions = TRUE
5958
#' )
60-
#' }
6159
#' @export
6260
#' @seealso [potential_interactions()]
6361
sv_dependence <- function(object, ...) {

R/sv_dependence2D.R

-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#' @param ... Arguments passed to [ggplot2::geom_jitter()].
3030
#' @returns An object of class "ggplot" (or "patchwork") representing a dependence plot.
3131
#' @examples
32-
#' \dontrun{
3332
#' dtrain <- xgboost::xgb.DMatrix(
3433
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
3534
#' )
@@ -48,7 +47,6 @@
4847
#' # mshapviz object
4948
#' mx <- split(sv, f = iris$Species)
5049
#' sv_dependence2D(mx, x = "Petal.Length", y = "Sepal.Width")
51-
#' }
5250
#' @export
5351
#' @seealso [sv_dependence()]
5452
sv_dependence2D <- function(object, ...) {

R/sv_force.R

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#' (via [ggrepel::geom_text_repel()]).
1212
#' @returns An object of class "ggplot" (or "patchwork") representing a force plot.
1313
#' @examples
14-
#' \dontrun{
1514
#' dtrain <- xgboost::xgb.DMatrix(
1615
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
1716
#' )
@@ -22,7 +21,6 @@
2221
#'
2322
#' # Aggregate over all observations with Petal.Length == 1.4
2423
#' sv_force(x, row_id = x$X$Petal.Length == 1.4)
25-
#' }
2624
#' @export
2725
#' @seealso [sv_waterfall()]
2826
sv_force <- function(object, ...) {

R/sv_importance.R

-3
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,13 @@
4646
#' `kind = "no"` - a named numeric vector of sorted SHAP feature importances
4747
#' (or a matrix in case of an object of class "mshapviz").
4848
#' @examples
49-
#' \dontrun{
5049
#' X_train <- data.matrix(iris[, -1])
5150
#' dtrain <- xgboost::xgb.DMatrix(X_train, label = iris[, 1], nthread = 1)
5251
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
5352
#' x <- shapviz(fit, X_pred = X_train)
5453
#' sv_importance(x)
5554
#' sv_importance(x, kind = "no")
5655
#' sv_importance(x, kind = "beeswarm", show_numbers = TRUE)
57-
#' }
58-
#'
5956
#' @seealso \code{\link{sv_interaction}}
6057
#' @export
6158
sv_importance <- function(object, ...) {

R/sv_interaction.R

-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
#' numeric matrix of average absolute SHAP interactions sorted by the average
1919
#' absolute SHAP values (or a list of such matrices in case of "mshapviz" object).
2020
#' @examples
21-
#' \dontrun{
2221
#' dtrain <- xgboost::xgb.DMatrix(
2322
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
2423
#' )
2524
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
2625
#' x <- shapviz(fit, X_pred = dtrain, X = iris, interactions = TRUE)
2726
#' sv_interaction(x, kind = "no")
2827
#' sv_interaction(x, max_display = 2, size = 3)
29-
#' }
3028
#' @seealso [sv_importance()]
3129
#' @export
3230
sv_interaction <- function(object, ...) {

R/sv_waterfall.R

-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#' will altogether suppress adding text to the bars.
3636
#' @returns An object of class "ggplot" (or "patchwork") representing a waterfall plot.
3737
#' @examples
38-
#' \dontrun{
3938
#' dtrain <- xgboost::xgb.DMatrix(
4039
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
4140
#' )
@@ -51,7 +50,6 @@
5150
#'
5251
#' # Aggregate over all observations with Petal.Length == 1.4
5352
#' sv_waterfall(x, row_id = x$X$Petal.Length == 1.4)
54-
#' }
5553
#' @export
5654
#' @seealso [sv_force()]
5755
sv_waterfall <- function(object, ...) {

cran-comments.md

+11-43
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,29 @@
1-
# shapviz 0.9.2
1+
# shapviz 0.9.3
22

3-
## Resubmission 7
3+
Hi CRAN team
44

5-
No effect of setDTthreads(2). Commenting out now all tests with xgboost.
6-
7-
## Resubmission 6
8-
9-
Test timing not fixed, still. Now testing to import {data.table} and setDTthreads(2) pre checks.
10-
11-
## Resubmission 5
12-
13-
Now trying
14-
15-
Sys.setenv(DT_NUM_THREADS = 1)
16-
Sys.setenv("TESTTHAT_CPUS" = 1)
17-
options(Ncpus = 1)
18-
19-
20-
## Resubmission 4
21-
22-
Trying to set Sys.setenv(DT_NUM_THREADS = 2) in the unit tests to fix the crazy Debian behaviour.
23-
24-
## Resubmission 3
25-
26-
Moving one single nthread = 1 into param = list(). Setting nrounds = 1 in all tests. If this does not help, I will need to delete most unit tests.
27-
28-
## Resubmission 2
29-
30-
Setting nthread = 1 in unit tests and vignettes. Hope this fixes the problems.
31-
32-
## Resubmission 1
33-
34-
Fixing problems with curly braces in .rd files.
35-
36-
### Original message
37-
38-
Hello CRAN team
39-
40-
{shapviz} already got 2 reverse dependencies, which look okay.
41-
42-
The update has mainly added more flexibility of the importance plots for multi-output models.
5+
This is a relatively small update, but offers much more flexibility in the interaction heuristic.
436

447
## Checks look good
458

469
### check(manual = TRUE, cran = TRUE)
4710

48-
- checking HTML version of manual ... NOTE
49-
Skipping checking HTML validation: no command 'tidy' found
11+
Ok
5012

5113
### RHub (usual notes)
5214

5315
* checking package dependencies ... NOTE
5416
Packages which this enhances but not available for checking:
5517
'fastshap', 'h2o', 'lightgbm'
5618
* checking HTML version of manual ... NOTE
57-
Skipping checking HTML validation: no command 'tidy' found
5819
Skipping checking math rendering: package 'V8' unavailable
20+
* checking for non-standard things in the check directory ... NOTE
21+
Found the following files/directories:
22+
''NULL''
23+
* checking for detritus in the temp directory ... NOTE
24+
Found the following files/directories:
25+
'lastMiKTeXException'
26+
5927

6028
### Winbuilder()
6129

man/shapviz.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_dependence.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_dependence2D.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_force.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_importance.Rd

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_interaction.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sv_waterfall.Rd

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

revdep/README.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,57 @@
1010
|collate |German_Switzerland.utf8 |
1111
|ctype |German_Switzerland.utf8 |
1212
|tz |Europe/Zurich |
13-
|date |2023-10-13 |
13+
|date |2024-01-12 |
1414
|rstudio |2023.06.1+524 Mountain Hydrangea (desktop) |
1515
|pandoc |3.1.6 @ C:\Users\Michael\AppData\Local\Pandoc\pandoc.exe |
1616

1717
# Dependencies
1818

1919
|package |old |new |Δ |
2020
|:------------|:-------|:-------|:--|
21-
|shapviz |0.9.1 |0.9.2 |* |
22-
|cli |3.6.1 |3.6.1 | |
21+
|shapviz |0.9.2 |0.9.3 |* |
22+
|cli |3.6.2 |3.6.2 | |
2323
|colorspace |2.1-0 |2.1-0 | |
2424
|commonmark |1.9.0 |1.9.0 | |
25-
|curl |5.1.0 |5.1.0 | |
26-
|data.table |1.14.8 |1.14.8 | |
27-
|fansi |1.0.5 |1.0.5 | |
25+
|curl |5.2.0 |5.2.0 | |
26+
|data.table |1.14.10 |1.14.10 | |
27+
|fansi |1.0.6 |1.0.6 | |
2828
|farver |2.1.1 |2.1.1 | |
2929
|ggfittext |0.10.1 |0.10.1 | |
3030
|gggenes |0.5.1 |0.5.1 | |
3131
|ggplot2 |3.4.4 |3.4.4 | |
32-
|ggrepel |0.9.3 |0.9.3 | |
33-
|glue |1.6.2 |1.6.2 | |
32+
|ggrepel |0.9.5 |0.9.5 | |
33+
|glue |1.7.0 |1.7.0 | |
3434
|gridtext |0.1.5 |0.1.5 | |
3535
|gtable |0.3.4 |0.3.4 | |
3636
|isoband |0.2.7 |0.2.7 | |
3737
|jpeg |0.1-10 |0.1-10 | |
38-
|jsonlite |1.8.7 |1.8.7 | |
38+
|jsonlite |1.8.8 |1.8.8 | |
3939
|labeling |0.4.3 |0.4.3 | |
40-
|lifecycle |1.0.3 |1.0.3 | |
40+
|lifecycle |1.0.4 |1.0.4 | |
4141
|magrittr |2.0.3 |2.0.3 | |
42-
|markdown |1.10 |1.10 | |
42+
|markdown |1.12 |1.12 | |
4343
|munsell |0.5.0 |0.5.0 | |
44-
|patchwork |1.1.3 |1.1.3 | |
44+
|patchwork |1.2.0 |1.2.0 | |
4545
|pillar |1.9.0 |1.9.0 | |
4646
|pkgconfig |2.0.3 |2.0.3 | |
4747
|png |0.1-8 |0.1-8 | |
4848
|R6 |2.5.1 |2.5.1 | |
4949
|RColorBrewer |1.1-3 |1.1-3 | |
50-
|Rcpp |1.0.11 |1.0.11 | |
51-
|rlang |1.1.1 |1.1.1 | |
52-
|scales |1.2.1 |1.2.1 | |
50+
|Rcpp |1.0.12 |1.0.12 | |
51+
|rlang |1.1.3 |1.1.3 | |
52+
|scales |1.3.0 |1.3.0 | |
5353
|shades |1.4.0 |1.4.0 | |
54-
|stringi |1.7.12 |1.7.12 | |
55-
|stringr |1.5.0 |1.5.0 | |
54+
|stringi |1.8.3 |1.8.3 | |
55+
|stringr |1.5.1 |1.5.1 | |
5656
|tibble |3.2.1 |3.2.1 | |
57-
|utf8 |1.2.3 |1.2.3 | |
58-
|vctrs |0.6.3 |0.6.3 | |
57+
|utf8 |1.2.4 |1.2.4 | |
58+
|vctrs |0.6.5 |0.6.5 | |
5959
|viridisLite |0.4.2 |0.4.2 | |
60-
|withr |2.5.1 |2.5.1 | |
61-
|xfun |0.40 |0.40 | |
62-
|xgboost |1.7.5.1 |1.7.5.1 | |
63-
|xml2 |1.3.5 |1.3.5 | |
60+
|withr |2.5.2 |2.5.2 | |
61+
|xfun |0.41 |0.41 | |
62+
|xgboost |1.7.6.1 |1.7.6.1 | |
63+
|xml2 |1.3.6 |1.3.6 | |
6464

6565
# Revdeps
6666

vignettes/basic_use.Rmd

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ set.seed(1)
6868
6969
# Build model
7070
x <- c("carat", "cut", "color", "clarity")
71-
dtrain <- xgb.DMatrix(data.matrix(diamonds[x]), label = diamonds$price)
72-
fit <- xgb.train(params = list(learning_rate = 0.1), data = dtrain, nrounds = 65)
71+
dtrain <- xgb.DMatrix(data.matrix(diamonds[x]), label = diamonds$price, nthread = 1)
72+
fit <- xgb.train(
73+
params = list(learning_rate = 0.1, nthread = 1), data = dtrain, nrounds = 65
74+
)
7375
7476
# SHAP analysis: X can even contain factors
7577
dia_2000 <- diamonds[sample(nrow(diamonds), 2000), x]

0 commit comments

Comments
 (0)