Skip to content

Commit

Permalink
Merge pull request #83 from ModelOriented/cran_subm
Browse files Browse the repository at this point in the history
CRAN candidate
  • Loading branch information
mayer79 authored Mar 31, 2023
2 parents edcbd02 + 4b7bcca commit a131854
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 35 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.4
Date: 2023-02-25 08:41:03 UTC
SHA: 01441b6edb0721229d98242fabe7795eaeb1af39
Version: 0.3.5
Date: 2023-03-31 11:06:08 UTC
SHA: 63c092a7f51eb9eed7d88e02e38431a2bf04d0ae
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Title: Kernel SHAP
Version: 0.3.5
Authors@R: c(
person("Michael", "Mayer", , "[email protected]", role = c("aut", "cre")),
person("David", "Watson", , "[email protected]", role = "ctb")
person("David", "Watson", , "[email protected]", role = "aut"),
person("Przemyslaw", "Biecek", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0001-8423-1823"))
)
Description: Efficient implementation of Kernel SHAP, see Lundberg and Lee
(2017) <https://dl.acm.org/doi/10.5555/3295222.3295230>, and Covert
Expand Down
15 changes: 7 additions & 8 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# kernelshap 0.3.5

## Github repository
## Maintenance

- New contributor: Przemyslaw Biecek - welcome on board!
- My new cozy home: https://github.com/ModelOriented/kernelshap
- Webpage created with "pgkdown": https://modeloriented.github.io/kernelshap
- Webpage created with "pkgdown"
- Introduced Github workflows
- More unit tests

## User visible changes
## Small visible changes

- Removed the `ks_extract()` function. It was designed to extract objects like the matrix `S` of SHAP values from the resulting "kernelshap" object `x`. We feel that the standard extraction options (`x$S`, `x[["S"]]`, or `getElement(x, "S")`) are sufficient.
- Adding $(n \times K)$ matrix of predictions to the output, where $n$ is the number of rows in the explainer data `X`, and $K$ is the dimension of a single prediction (usually 1).

## Other changes

- More unit tests

- Setting `verbose = FALSE` now does not suppress the warning on too large background data anymore. Use `suppressWarnings()` instead.

# kernelshap 0.3.4

Expand Down
6 changes: 3 additions & 3 deletions R/kernelshap.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ kernelshap.default <- function(object, X, bg_X, pred_fun = stats::predict,
if (verbose) {
message(txt)
}
if (verbose && max(m, m_exact) * bg_n > 2e5) {
if (max(m, m_exact) * bg_n > 2e5) {
warning("\nPredictions on large data sets with ", max(m, m_exact), "x", bg_n,
" observations are being done. Consider reducing the computational burden ",
"(e.g. exact = FALSE, low hybrid_degree, smaller background data, smaller m)")
" observations are being done.\n",
"Consider reducing the computational burden (e.g. use smaller X_bg)")
}

# Apply Kernel SHAP to each row of X
Expand Down
22 changes: 9 additions & 13 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
Dear CRAN team
Hello CRAN

This is mainly a documentation update (new logo, better DESCRIPTION, better README, adding a relevant link to the description file).
This is mainly a documentation update (new contributor, new Github repo),
with only some small code changes (removing unnecessary function).

## Checks

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

── R CMD check results ──────────── kernelshap 0.3.4 ────
Duration: 30.9s
survex: OK

unable to verify current time
### `check(manual = TRUE, cran = TRUE)`

0 errors ✔ | 0 warnings ✔ | 1 note ✖
Note: unable to verify current time

### `check_win_devel()`

1 NOTE
R Under development (unstable) (2023-02-23 r83894 ucrt)

OK

### `check_rhub()`

Status: OK


OK
9 changes: 6 additions & 3 deletions packaging.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ use_description(
Otherwise, an almost exact hybrid algorithm involving iterative sampling is used.
The package plays well together with meta-learning packages like 'tidymodels', 'caret' or 'mlr3'.
Visualizations can be done using the R package 'shapviz'.",
`Authors@R` = "c(person('Michael', family = 'Mayer', role = c('aut', 'cre'), email = '[email protected]'),
person('David', family = 'Watson', role = 'ctb', email = '[email protected]'))",
`Authors@R` =
"c(person('Michael', family='Mayer', role=c('aut', 'cre'), email='[email protected]'),
person('David', family='Watson', role='aut', email='[email protected]'),
person('Przemyslaw', family='Biecek', email='[email protected]', role='ctb', comment=c(ORCID='0000-0001-8423-1823'))
)",
Depends = "R (>= 3.2.0)",
LazyData = NULL
),
Expand All @@ -41,7 +44,7 @@ use_gpl_license(2)

# Your files that do not belong to the package itself (others are added by "use_* function")
use_build_ignore(c("^packaging.R$", "[.]Rproj$", "^compare_with_python.R$",
"^cran-comments.md$", "^logo.png$", "^Z_exact.R$"), escape = FALSE)
"^cran-comments.md$", "^logo.png$"), escape = FALSE)

# If your code uses the pipe operator %>%
# use_pipe()
Expand Down
26 changes: 26 additions & 0 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Platform

|field |value |
|:--------|:----------------------------------------------------|
|version |R version 4.2.2 (2022-10-31 ucrt) |
|os |Windows 10 x64 (build 22621) |
|system |x86_64, mingw32 |
|ui |RStudio |
|language |(EN) |
|collate |German_Switzerland.utf8 |
|ctype |German_Switzerland.utf8 |
|tz |Europe/Berlin |
|date |2023-03-31 |
|rstudio |2022.12.0+353 Elsbeth Geranium (desktop) |
|pandoc |2.12 @ C:\Users\Michael\anaconda3\Scripts\pandoc.exe |

# Dependencies

|package |old |new |Δ |
|:----------|:------|:------|:--|
|kernelshap |0.3.4 |0.3.5 |* |
|foreach |1.5.2 |1.5.2 | |
|iterators |1.0.14 |1.0.14 | |

# Revdeps

7 changes: 7 additions & 0 deletions revdep/cran.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## revdepcheck results

We checked 1 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages

1 change: 1 addition & 0 deletions revdep/failures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*Wow, no problems at all. :)*
1 change: 1 addition & 0 deletions revdep/problems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*Wow, no problems at all. :)*
6 changes: 2 additions & 4 deletions tests/testthat/test-kernelshap.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ test_that("verbose is chatty", {

test_that("large background data cause warning", {
large_bg <- iris[rep(1:150, 230), ]
suppressMessages(
expect_warning(
kernelshap(fit, iris[1L, x], bg_X = large_bg, verbose = TRUE)
)
expect_warning(
kernelshap(fit, iris[1L, x], bg_X = large_bg, verbose = FALSE)
)
})

Expand Down

0 comments on commit a131854

Please sign in to comment.