From a90a0ea6a15459d6b3275388f6ebc3ce0f625e56 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 31 Mar 2023 12:38:45 +0200 Subject: [PATCH 1/4] CRAN candidate --- DESCRIPTION | 4 +++- NEWS.md | 15 +++++++-------- R/kernelshap.R | 6 +++--- cran-comments.md | 22 +++++++++------------- packaging.R | 9 ++++++--- tests/testthat/test-kernelshap.R | 6 ++---- 6 files changed, 30 insertions(+), 32 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 23f2509..0b61b8f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,9 @@ Title: Kernel SHAP Version: 0.3.5 Authors@R: c( person("Michael", "Mayer", , "mayermichael79@gmail.com", role = c("aut", "cre")), - person("David", "Watson", , "david.s.watson11@gmail.com", role = "ctb") + person("David", "Watson", , "david.s.watson11@gmail.com", role = "aut"), + person("Przemyslaw", "Biecek", , "przemyslaw.biecek@gmail.com", role = "ctb", + comment = c(ORCID = "0000-0001-8423-1823")) ) Description: Efficient implementation of Kernel SHAP, see Lundberg and Lee (2017) , and Covert diff --git a/NEWS.md b/NEWS.md index ccb5c8d..201fd39 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/kernelshap.R b/R/kernelshap.R index c538b08..76cf295 100644 --- a/R/kernelshap.R +++ b/R/kernelshap.R @@ -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 diff --git a/cran-comments.md b/cran-comments.md index ae9ef3c..fb92185 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -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 +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) - +TODO ### `check_rhub()` -Status: OK - - +TODO diff --git a/packaging.R b/packaging.R index 99c0f60..9844271 100644 --- a/packaging.R +++ b/packaging.R @@ -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 = 'mayermichael79@gmail.com'), - person('David', family = 'Watson', role = 'ctb', email = 'david.s.watson11@gmail.com'))", + `Authors@R` = + "c(person('Michael', family='Mayer', role=c('aut', 'cre'), email='mayermichael79@gmail.com'), + person('David', family='Watson', role='aut', email='david.s.watson11@gmail.com'), + person('Przemyslaw', family='Biecek', email='przemyslaw.biecek@gmail.com', role='ctb', comment=c(ORCID='0000-0001-8423-1823')) + )", Depends = "R (>= 3.2.0)", LazyData = NULL ), @@ -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() diff --git a/tests/testthat/test-kernelshap.R b/tests/testthat/test-kernelshap.R index 3c0e9a6..9a70d63 100644 --- a/tests/testthat/test-kernelshap.R +++ b/tests/testthat/test-kernelshap.R @@ -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) ) }) From 45d03089d8f40f75948c8e12156e3b8b404b5ca2 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 31 Mar 2023 12:56:37 +0200 Subject: [PATCH 2/4] revdep --- cran-comments.md | 4 ++-- revdep/README.md | 26 ++++++++++++++++++++++++++ revdep/cran.md | 7 +++++++ revdep/failures.md | 1 + revdep/problems.md | 1 + 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 revdep/README.md create mode 100644 revdep/cran.md create mode 100644 revdep/failures.md create mode 100644 revdep/problems.md diff --git a/cran-comments.md b/cran-comments.md index fb92185..0ffac62 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -7,7 +7,7 @@ with only some small code changes (removing unnecessary function). ### Revdep -OK +survex: OK ### `check(manual = TRUE, cran = TRUE)` @@ -19,4 +19,4 @@ TODO ### `check_rhub()` -TODO +Note: lastMiKTeXException diff --git a/revdep/README.md b/revdep/README.md new file mode 100644 index 0000000..6a99a8f --- /dev/null +++ b/revdep/README.md @@ -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 + diff --git a/revdep/cran.md b/revdep/cran.md new file mode 100644 index 0000000..782ef68 --- /dev/null +++ b/revdep/cran.md @@ -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 + diff --git a/revdep/failures.md b/revdep/failures.md new file mode 100644 index 0000000..9a20736 --- /dev/null +++ b/revdep/failures.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file diff --git a/revdep/problems.md b/revdep/problems.md new file mode 100644 index 0000000..9a20736 --- /dev/null +++ b/revdep/problems.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file From 63c092a7f51eb9eed7d88e02e38431a2bf04d0ae Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 31 Mar 2023 13:04:07 +0200 Subject: [PATCH 3/4] finish cran-comments --- cran-comments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 0ffac62..bc5ce97 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -15,8 +15,8 @@ Note: unable to verify current time ### `check_win_devel()` -TODO +OK ### `check_rhub()` -Note: lastMiKTeXException +OK From 4b7bcca6fd48ae095763ee826caff8fda2f925e9 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 31 Mar 2023 13:29:04 +0200 Subject: [PATCH 4/4] submission tag --- CRAN-SUBMISSION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 8548b40..9e2eeb3 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -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