Skip to content

Commit

Permalink
Merge pull request #17 from bips-hb/no_boston
Browse files Browse the repository at this point in the history
Remove test with boston housing data
  • Loading branch information
mnwright authored Nov 5, 2024
2 parents f2feb8f + 9fcdd8a commit e43d710
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
34 changes: 14 additions & 20 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -18,7 +20,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand All @@ -29,30 +31,22 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: cpi
Type: Package
Title: Conditional Predictive Impact
Version: 0.1.4
Date: 2022-03-02
Version: 0.1.5
Date: 2024-11-05
Authors@R:
c(person(given = "Marvin N.",
family = "Wright",
Expand All @@ -28,7 +28,6 @@ URL: https://github.com/bips-hb/cpi,
BugReports: https://github.com/bips-hb/cpi/issues
Imports: foreach, mlr3, lgr, knockoff
Suggests:
BEST,
mlr3learners,
ranger,
glmnet,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# cpi 0.1.5
* Remove BEST dependency (removed from CRAN)

# cpi 0.1.4
* Reset options() in vignette

Expand Down
15 changes: 9 additions & 6 deletions R/cpi.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ cpi <- function(task, learner,
stop("Unknown test in 'test' argument.")
}
if (test == "bayes") {
if (!requireNamespace("BEST", quietly = TRUE)) {
stop("Package \"BEST\" needed for Bayesian testing. Please install it.",
call. = FALSE)
}
# if (!requireNamespace("BEST", quietly = TRUE)) {
# stop("Package \"BEST\" needed for Bayesian testing. Please install it.",
# call. = FALSE)
# }
stop("Bayesian testing currently not implemented as BEST package was removed from CRAN.",
call. = FALSE)
}

if (task$task_type == "classif" & measure$id %in% c("classif.logloss", "classif.bbrier")) {
Expand Down Expand Up @@ -309,8 +311,9 @@ cpi <- function(task, learner,
res$p.value <- (sum(perm_means >= orig_mean) + 1)/(B + 1)
res$ci.lo <- orig_mean - quantile(perm_means, 1 - alpha)
} else if (test == "bayes") {
res <- list(BEST::BESTmcmc(dif, parallel = FALSE, verbose = FALSE))
names(res) <- task$feature_names[i]
#res <- list(BEST::BESTmcmc(dif, parallel = FALSE, verbose = FALSE))
#names(res) <- task$feature_names[i]
message("Bayesian testing currently not implemented as BEST package was removed from CRAN.")
} else if (test %in% c('t', 'wilcox', 'binom')) {
if (test == "t") {
test_result <- t.test(dif, alternative = 'greater',
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- badges: start -->
[![R-CMD-check](https://github.com/bips-hb/cpi/workflows/R-CMD-check/badge.svg)](https://github.com/bips-hb/cpi/actions)
[![check-standard](https://github.com/bips-hb/cpi/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/bips-hb/cpi/actions/workflows/check-standard.yaml)
<!-- badges: end -->

## Conditional Predictive Impact
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-check_args.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ test_that("fails for wrong groups", {
"Feature numbers in argument 'groups' not in 1:p, where p is the number of features.")
})

test_that("fails with Gaussian knockoffs and factors", {
expect_error(cpi(task = tsk("boston_housing"),
learner = lrn("regr.lm"),
resampling = rsmp("holdout")),
"Gaussian knockoffs cannot handle factor features\\. Consider using sequential knockoffs \\(see examples\\) or recoding factors\\.")
})
# test_that("fails with Gaussian knockoffs and factors", {
# expect_error(cpi(task = tsk("ames_housing"),
# learner = lrn("regr.lm"),
# resampling = rsmp("holdout")),
# "Gaussian knockoffs cannot handle factor features\\. Consider using sequential knockoffs \\(see examples\\) or recoding factors\\.")
# })

0 comments on commit e43d710

Please sign in to comment.