Skip to content

Commit

Permalink
Merge pull request #110 from ModelOriented/CRAN-update
Browse files Browse the repository at this point in the history
Preparation of CRAN release
  • Loading branch information
mayer79 authored Nov 10, 2023
2 parents a690ff6 + 4478f17 commit a9456f4
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 106 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.3.8
Date: 2023-09-23 12:06:38 UTC
SHA: 7ca4f7e46e925abd8cf0155227d126ebd9ea2364
Version: 0.4.0
Date: 2023-11-10 18:24:23 UTC
SHA: 4b25bb0b9f2223185eac1fe01a19d6014d01eb12
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ S3method(permshap,ranger)
S3method(print,kernelshap)
S3method(print,permshap)
S3method(summary,kernelshap)
S3method(summary,permshap)
export(is.kernelshap)
export(is.permshap)
export(kernelshap)
Expand Down
4 changes: 2 additions & 2 deletions R/kernelshap.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
#' see README for an example. Parallelization automatically disables the progress bar.
#' @param parallel_args Named list of arguments passed to [foreach::foreach()].
#' Ideally, this is `NULL` (default). Only relevant if `parallel = TRUE`.
#' Example on Windows: if `object` is a GAM fitted with package {mgcv},
#' Example on Windows: if `object` is a GAM fitted with package 'mgcv',
#' then one might need to set `parallel_args = list(.packages = "mgcv")`.
#' @param verbose Set to `FALSE` to suppress messages and the progress bar.
#' @param ... Additional arguments passed to `pred_fun(object, X, ...)`.
Expand Down Expand Up @@ -165,7 +165,7 @@
#' s
#'
#' # MODEL TWO: Multi-response linear regression
#' fit <- lm(as.matrix(iris[1:2]) ~ Petal.Length + Petal.Width + Species, data = iris)
#' fit <- lm(as.matrix(iris[, 1:2]) ~ Petal.Length + Petal.Width + Species, data = iris)
#' s <- kernelshap(fit, iris[1:4, 3:5], bg_X = bg_X)
#' summary(s)
#'
Expand Down
50 changes: 35 additions & 15 deletions R/methods.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#' Print Method
#'
#' Prints the first two rows of the matrix (or matrices) of SHAP values.
#' Prints "kernelshap" Object
#'
#' @param x An object of class "kernelshap".
#' @param n Maximum number of rows of SHAP values to print.
#' @param ... Further arguments passed from other methods.
#' @returns Invisibly, the input is returned.
#' @export
#' @examples
#' fit <- stats::lm(Sepal.Length ~ ., data = iris)
#' s <- kernelshap(fit, iris[1:3, -1], bg_X = iris[-1])
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- kernelshap(fit, iris[1:3, -1], bg_X = iris[, -1])
#' s
#' @seealso [kernelshap()]
print.kernelshap <- function(x, n = 2L, ...) {
Expand All @@ -18,25 +16,32 @@ print.kernelshap <- function(x, n = 2L, ...) {
invisible(x)
}

#' @describeIn print.kernelshap Print method for "permshap" object
#' Prints "permshap" Object
#'
#' @param x An object of class "permshap".
#' @inheritParams print.kernelshap
#' @inherit print.kernelshap return
#' @export
#' @examples
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- permshap(fit, iris[1:3, -1], bg_X = iris[, -1])
#' s
#' @seealso [permshap()]
print.permshap <- function(x, n = 2L, ...) {
print.kernelshap(x, n = n, ...)
}

#' Summary Method
#' Summarizes "kernelshap" Object
#'
#' @param object An object of class "kernelshap".
#' @param compact Set to `TRUE` to hide printing the top n SHAP values,
#' standard errors and feature values.
#' @param n Maximum number of rows of SHAP values, standard errors and feature values
#' to print.
#' @param compact Set to `TRUE` for a more compact summary.
#' @param n Maximum number of rows of SHAP values etc. to print.
#' @param ... Further arguments passed from other methods.
#' @returns Invisibly, the input is returned.
#' @export
#' @examples
#' fit <- stats::lm(Sepal.Length ~ ., data = iris)
#' s <- kernelshap(fit, iris[1:3, -1], bg_X = iris[-1])
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- kernelshap(fit, iris[1:3, -1], bg_X = iris[, -1])
#' summary(s)
#' @seealso [kernelshap()]
summary.kernelshap <- function(object, compact = FALSE, n = 2L, ...) {
Expand Down Expand Up @@ -74,6 +79,21 @@ summary.kernelshap <- function(object, compact = FALSE, n = 2L, ...) {
invisible(object)
}

#' Summarizes "permshap" Object
#'
#' @param object An object of class "permshap".
#' @inheritParams summary.kernelshap
#' @inherit summary.kernelshap return
#' @export
#' @examples
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- permshap(fit, iris[1:3, -1], bg_X = iris[, -1])
#' summary(s)
#' @seealso [permshap()]
summary.permshap <- function(object, compact = FALSE, n = 2L, ...) {
summary.kernelshap(object, compact = compact, n = n, ...)
}

#' Check for kernelshap
#'
#' Is object of class "kernelshap"?
Expand All @@ -83,7 +103,7 @@ summary.kernelshap <- function(object, compact = FALSE, n = 2L, ...) {
#' @export
#' @examples
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- kernelshap(fit, iris[1:2, -1], bg_X = iris[-1])
#' s <- kernelshap(fit, iris[1:2, -1], bg_X = iris[, -1])
#' is.kernelshap(s)
#' is.kernelshap("a")
#' @seealso [kernelshap()]
Expand All @@ -100,7 +120,7 @@ is.kernelshap <- function(object){
#' @export
#' @examples
#' fit <- lm(Sepal.Length ~ ., data = iris)
#' s <- permshap(fit, iris[1:2, -1], bg_X = iris[-1])
#' s <- permshap(fit, iris[1:2, -1], bg_X = iris[, -1])
#' is.permshap(s)
#' is.permshap("a")
#' @seealso [kernelshap()]
Expand Down
2 changes: 1 addition & 1 deletion R/permshap.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#' s
#'
#' # MODEL TWO: Multi-response linear regression
#' fit <- lm(as.matrix(iris[1:2]) ~ Petal.Length + Petal.Width + Species, data = iris)
#' fit <- lm(as.matrix(iris[, 1:2]) ~ Petal.Length + Petal.Width + Species, data = iris)
#' s <- permshap(fit, iris[1:4, 3:5], bg_X = bg_X)
#' s
#'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The package contains two workhorses to calculate SHAP values for any model:

### Kernel SHAP or permutation SHAP?

- Exact Kernel SHAP and exact permutation SHAP values agree for additive models, and differ for models with interactions.
- Exact Kernel SHAP and exact permutation SHAP values (usually) agree for additive models.
- If the number of features is sufficiently small, we recommend `permshap()` over `kernelshap()`.

### Typical workflow to explain any model
Expand Down
60 changes: 9 additions & 51 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,33 @@
# Resubmission II
# kernelshap 0.4.0

I have now removed the non-registered DOI from the description file.
Dear CRAN-team

This was Uwe's comment:
I have added exact permutation SHAP values, and the possibility to use factor-valued predictions.

Found the following (possibly) invalid DOIs:
DOI: 10.5555/3295222.3295230
From: DESCRIPTION
Status: 404
Message: Not Found

and looking for the DOI shows it is not registered.
Even when going to
https://dl.acm.org/doi/10.5555/3295222.3295230
and clicking on the "Publisher Site" link leads us into nirvana.

So I guess the is ill registered and you have to revert the change. My
apologoies, I had not checked whether the DOI given is registreed or not.

Best,


# Resubmission I

I stumbled over a DOI: Uwe gently pointed this out:

"
The Description field contains
<https://dl.acm.org/doi/10.5555/3295222.3295230>, and Covert and Lee
Please use permanent DOI markup for linking to publications as in
<doi:prefix/suffix>.
"

This resubmission fixes this.

# Original message

Hello CRAN

This is a small maintenance release only.

Thanks a lot
Thanks a lot for running CRAN.

Michael

## Checks

### Revdep

survex 1.1.3
survex 1.2.0
- OK: 1
- BROKEN: 0

### Local check with innocent NOTE
### Local check with usual NOTE

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

### `check_win_devel()` NOTE

- R Under development (unstable) (2023-09-11 r85126 ucrt)
- R Under development (unstable) (2023-11-09 r85497 ucrt)

### `check_rhub()` NOTES

-> Note sure where the 403 problem comes from. Is it relevant?

Found the following (possibly) invalid URLs:
URL: https://dl.acm.org/doi/10.5555/3295222.3295230
From: DESCRIPTION
Status: 403
Message: Forbidden
* checking HTML version of manual ... NOTE
Skipping checking HTML validation: no command 'tidy' found
Skipping checking math rendering: package 'V8' unavailable

2 changes: 1 addition & 1 deletion man/is.kernelshap.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/is.permshap.Rd

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

4 changes: 2 additions & 2 deletions man/kernelshap.Rd

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

4 changes: 2 additions & 2 deletions man/permshap.Rd

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

16 changes: 4 additions & 12 deletions man/print.kernelshap.Rd

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

29 changes: 29 additions & 0 deletions man/print.permshap.Rd

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

14 changes: 6 additions & 8 deletions man/summary.kernelshap.Rd

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

Loading

0 comments on commit a9456f4

Please sign in to comment.