Skip to content

Commit

Permalink
Merge pull request #132 from ModelOriented/cran-1
Browse files Browse the repository at this point in the history
CRAN Release
  • Loading branch information
mayer79 authored Jan 12, 2024
2 parents 1e39218 + b97d7a9 commit 8e4c726
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 101 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.9.2
Date: 2023-10-14 16:44:29 UTC
SHA: 1d239694c309c6b48168b2ca19b8fd5c8d6f1d2d
Version: 0.9.3
Date: 2024-01-12 11:21:47 UTC
SHA: d2f329e540177df778e787a27dec50d34cb5ed5c
2 changes: 0 additions & 2 deletions R/shapviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ shapviz.matrix = function(object, X, baseline = 0, collapse = NULL,
#' Creates a "shapviz" object from an XGBoost model.
#' @export
#' @examples
#' \dontrun{
#' # XGBoost models
#' X_pred <- data.matrix(iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1], nthread = 1)
Expand Down Expand Up @@ -184,7 +183,6 @@ shapviz.matrix = function(object, X, baseline = 0, collapse = NULL,
#' mx
#' all.equal(mx[[3]], x)
#' }
#' }
shapviz.xgb.Booster = function(object, X_pred, X = X_pred, which_class = NULL,
collapse = NULL, interactions = FALSE, ...) {
stopifnot(
Expand Down
2 changes: 0 additions & 2 deletions R/sv_dependence.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#' @param ... Arguments passed to [ggplot2::geom_jitter()].
#' @returns An object of class "ggplot" (or "patchwork") representing a dependence plot.
#' @examples
#' \dontrun{
#' dtrain <- xgboost::xgb.DMatrix(
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
#' )
Expand All @@ -57,7 +56,6 @@
#' sv_dependence(
#' x2, c("Petal.Length", "Species"), color_var = NULL, interactions = TRUE
#' )
#' }
#' @export
#' @seealso [potential_interactions()]
sv_dependence <- function(object, ...) {
Expand Down
2 changes: 0 additions & 2 deletions R/sv_dependence2D.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#' @param ... Arguments passed to [ggplot2::geom_jitter()].
#' @returns An object of class "ggplot" (or "patchwork") representing a dependence plot.
#' @examples
#' \dontrun{
#' dtrain <- xgboost::xgb.DMatrix(
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
#' )
Expand All @@ -48,7 +47,6 @@
#' # mshapviz object
#' mx <- split(sv, f = iris$Species)
#' sv_dependence2D(mx, x = "Petal.Length", y = "Sepal.Width")
#' }
#' @export
#' @seealso [sv_dependence()]
sv_dependence2D <- function(object, ...) {
Expand Down
2 changes: 0 additions & 2 deletions R/sv_force.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#' (via [ggrepel::geom_text_repel()]).
#' @returns An object of class "ggplot" (or "patchwork") representing a force plot.
#' @examples
#' \dontrun{
#' dtrain <- xgboost::xgb.DMatrix(
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
#' )
Expand All @@ -22,7 +21,6 @@
#'
#' # Aggregate over all observations with Petal.Length == 1.4
#' sv_force(x, row_id = x$X$Petal.Length == 1.4)
#' }
#' @export
#' @seealso [sv_waterfall()]
sv_force <- function(object, ...) {
Expand Down
3 changes: 0 additions & 3 deletions R/sv_importance.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,13 @@
#' `kind = "no"` - a named numeric vector of sorted SHAP feature importances
#' (or a matrix in case of an object of class "mshapviz").
#' @examples
#' \dontrun{
#' X_train <- data.matrix(iris[, -1])
#' dtrain <- xgboost::xgb.DMatrix(X_train, label = iris[, 1], nthread = 1)
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
#' x <- shapviz(fit, X_pred = X_train)
#' sv_importance(x)
#' sv_importance(x, kind = "no")
#' sv_importance(x, kind = "beeswarm", show_numbers = TRUE)
#' }
#'
#' @seealso \code{\link{sv_interaction}}
#' @export
sv_importance <- function(object, ...) {
Expand Down
2 changes: 0 additions & 2 deletions R/sv_interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
#' numeric matrix of average absolute SHAP interactions sorted by the average
#' absolute SHAP values (or a list of such matrices in case of "mshapviz" object).
#' @examples
#' \dontrun{
#' dtrain <- xgboost::xgb.DMatrix(
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
#' )
#' fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
#' x <- shapviz(fit, X_pred = dtrain, X = iris, interactions = TRUE)
#' sv_interaction(x, kind = "no")
#' sv_interaction(x, max_display = 2, size = 3)
#' }
#' @seealso [sv_importance()]
#' @export
sv_interaction <- function(object, ...) {
Expand Down
2 changes: 0 additions & 2 deletions R/sv_waterfall.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#' will altogether suppress adding text to the bars.
#' @returns An object of class "ggplot" (or "patchwork") representing a waterfall plot.
#' @examples
#' \dontrun{
#' dtrain <- xgboost::xgb.DMatrix(
#' data.matrix(iris[, -1]), label = iris[, 1], nthread = 1
#' )
Expand All @@ -51,7 +50,6 @@
#'
#' # Aggregate over all observations with Petal.Length == 1.4
#' sv_waterfall(x, row_id = x$X$Petal.Length == 1.4)
#' }
#' @export
#' @seealso [sv_force()]
sv_waterfall <- function(object, ...) {
Expand Down
54 changes: 11 additions & 43 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,29 @@
# shapviz 0.9.2
# shapviz 0.9.3

## Resubmission 7
Hi CRAN team

No effect of setDTthreads(2). Commenting out now all tests with xgboost.

## Resubmission 6

Test timing not fixed, still. Now testing to import {data.table} and setDTthreads(2) pre checks.

## Resubmission 5

Now trying

Sys.setenv(DT_NUM_THREADS = 1)
Sys.setenv("TESTTHAT_CPUS" = 1)
options(Ncpus = 1)


## Resubmission 4

Trying to set Sys.setenv(DT_NUM_THREADS = 2) in the unit tests to fix the crazy Debian behaviour.

## Resubmission 3

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.

## Resubmission 2

Setting nthread = 1 in unit tests and vignettes. Hope this fixes the problems.

## Resubmission 1

Fixing problems with curly braces in .rd files.

### Original message

Hello CRAN team

{shapviz} already got 2 reverse dependencies, which look okay.

The update has mainly added more flexibility of the importance plots for multi-output models.
This is a relatively small update, but offers much more flexibility in the interaction heuristic.

## Checks look good

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

- checking HTML version of manual ... NOTE
Skipping checking HTML validation: no command 'tidy' found
Ok

### RHub (usual notes)

* checking package dependencies ... NOTE
Packages which this enhances but not available for checking:
'fastshap', 'h2o', 'lightgbm'
* checking HTML version of manual ... NOTE
Skipping checking HTML validation: no command 'tidy' found
Skipping checking math rendering: package 'V8' unavailable
* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
''NULL''
* checking for detritus in the temp directory ... NOTE
Found the following files/directories:
'lastMiKTeXException'


### Winbuilder()

Expand Down
2 changes: 0 additions & 2 deletions man/shapviz.Rd

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

2 changes: 0 additions & 2 deletions man/sv_dependence.Rd

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

2 changes: 0 additions & 2 deletions man/sv_dependence2D.Rd

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

2 changes: 0 additions & 2 deletions man/sv_force.Rd

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

3 changes: 0 additions & 3 deletions man/sv_importance.Rd

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

2 changes: 0 additions & 2 deletions man/sv_interaction.Rd

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

2 changes: 0 additions & 2 deletions man/sv_waterfall.Rd

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

46 changes: 23 additions & 23 deletions revdep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,57 @@
|collate |German_Switzerland.utf8 |
|ctype |German_Switzerland.utf8 |
|tz |Europe/Zurich |
|date |2023-10-13 |
|date |2024-01-12 |
|rstudio |2023.06.1+524 Mountain Hydrangea (desktop) |
|pandoc |3.1.6 @ C:\Users\Michael\AppData\Local\Pandoc\pandoc.exe |

# Dependencies

|package |old |new |Δ |
|:------------|:-------|:-------|:--|
|shapviz |0.9.1 |0.9.2 |* |
|cli |3.6.1 |3.6.1 | |
|shapviz |0.9.2 |0.9.3 |* |
|cli |3.6.2 |3.6.2 | |
|colorspace |2.1-0 |2.1-0 | |
|commonmark |1.9.0 |1.9.0 | |
|curl |5.1.0 |5.1.0 | |
|data.table |1.14.8 |1.14.8 | |
|fansi |1.0.5 |1.0.5 | |
|curl |5.2.0 |5.2.0 | |
|data.table |1.14.10 |1.14.10 | |
|fansi |1.0.6 |1.0.6 | |
|farver |2.1.1 |2.1.1 | |
|ggfittext |0.10.1 |0.10.1 | |
|gggenes |0.5.1 |0.5.1 | |
|ggplot2 |3.4.4 |3.4.4 | |
|ggrepel |0.9.3 |0.9.3 | |
|glue |1.6.2 |1.6.2 | |
|ggrepel |0.9.5 |0.9.5 | |
|glue |1.7.0 |1.7.0 | |
|gridtext |0.1.5 |0.1.5 | |
|gtable |0.3.4 |0.3.4 | |
|isoband |0.2.7 |0.2.7 | |
|jpeg |0.1-10 |0.1-10 | |
|jsonlite |1.8.7 |1.8.7 | |
|jsonlite |1.8.8 |1.8.8 | |
|labeling |0.4.3 |0.4.3 | |
|lifecycle |1.0.3 |1.0.3 | |
|lifecycle |1.0.4 |1.0.4 | |
|magrittr |2.0.3 |2.0.3 | |
|markdown |1.10 |1.10 | |
|markdown |1.12 |1.12 | |
|munsell |0.5.0 |0.5.0 | |
|patchwork |1.1.3 |1.1.3 | |
|patchwork |1.2.0 |1.2.0 | |
|pillar |1.9.0 |1.9.0 | |
|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.11 |1.0.11 | |
|rlang |1.1.1 |1.1.1 | |
|scales |1.2.1 |1.2.1 | |
|Rcpp |1.0.12 |1.0.12 | |
|rlang |1.1.3 |1.1.3 | |
|scales |1.3.0 |1.3.0 | |
|shades |1.4.0 |1.4.0 | |
|stringi |1.7.12 |1.7.12 | |
|stringr |1.5.0 |1.5.0 | |
|stringi |1.8.3 |1.8.3 | |
|stringr |1.5.1 |1.5.1 | |
|tibble |3.2.1 |3.2.1 | |
|utf8 |1.2.3 |1.2.3 | |
|vctrs |0.6.3 |0.6.3 | |
|utf8 |1.2.4 |1.2.4 | |
|vctrs |0.6.5 |0.6.5 | |
|viridisLite |0.4.2 |0.4.2 | |
|withr |2.5.1 |2.5.1 | |
|xfun |0.40 |0.40 | |
|xgboost |1.7.5.1 |1.7.5.1 | |
|xml2 |1.3.5 |1.3.5 | |
|withr |2.5.2 |2.5.2 | |
|xfun |0.41 |0.41 | |
|xgboost |1.7.6.1 |1.7.6.1 | |
|xml2 |1.3.6 |1.3.6 | |

# Revdeps

6 changes: 4 additions & 2 deletions vignettes/basic_use.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ set.seed(1)
# Build model
x <- c("carat", "cut", "color", "clarity")
dtrain <- xgb.DMatrix(data.matrix(diamonds[x]), label = diamonds$price)
fit <- xgb.train(params = list(learning_rate = 0.1), data = dtrain, nrounds = 65)
dtrain <- xgb.DMatrix(data.matrix(diamonds[x]), label = diamonds$price, nthread = 1)
fit <- xgb.train(
params = list(learning_rate = 0.1, nthread = 1), data = dtrain, nrounds = 65
)
# SHAP analysis: X can even contain factors
dia_2000 <- diamonds[sample(nrow(diamonds), 2000), x]
Expand Down

0 comments on commit 8e4c726

Please sign in to comment.