Skip to content

Commit be20e27

Browse files
committed
update for new CRAN policies
1 parent efb3123 commit be20e27

File tree

12 files changed

+45
-20
lines changed

12 files changed

+45
-20
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Imports:
4747
mlr3misc (>= 0.8.0),
4848
mlr3pipelines (>= 0.3.0),
4949
R6 (>= 2.4.1),
50+
rmarkdown,
5051
rpart,
5152
glmnet
5253
Suggests:
@@ -61,7 +62,6 @@ Suggests:
6162
paradox,
6263
knitr,
6364
ranger,
64-
rmarkdown,
6565
xgboost,
6666
covr,
6767
testthat (>= 3.1.0)

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import(glmnet)
2121
import(mlr3)
2222
import(mlr3misc)
2323
import(mlr3pipelines)
24+
import(rmarkdown)
2425
import(rpart)
2526
importFrom(R6,R6Class)
2627
importFrom(R6,is.R6)

R/zzz.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#' @import glmnet
66
#' @import rpart
77
#' @import mlr3pipelines
8+
#' @import rmarkdown
89
#' @importFrom R6 R6Class is.R6
910
#' @importFrom utils head
1011
#' @importFrom stats contrasts runif rnorm setNames quantile

tests/testthat/test_auditor_fitters.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test_that("LearnerAuditorFitters work", {
1616
})
1717

1818
test_that("TreeAuditorFitters work", {
19+
skip_if_not_installed("mlr3learners")
1920
skip_if_not_installed("rpart")
2021
rf = TreeAuditorFitter$new()
2122
out = rf$fit(iris[, 1:4], runif(150))

tests/testthat/test_cv_predictors.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ skip_if_not_installed("mlr3")
22

33
test_that("TreeAuditorFitters work", {
44
skip_on_cran()
5+
skip_if_not_installed("mlr3learners")
56
skip_if_not_installed("rpart")
67
rf = CVTreeAuditorFitter$new()
78
out = rf$fit(iris[, 1:4], runif(150))
@@ -14,6 +15,8 @@ test_that("TreeAuditorFitters work", {
1415

1516
test_that("MCBoost multicalibrate and predict_probs - CV Predictor", {
1617
skip_on_cran()
18+
skip_if_not_installed("mlr3learners")
19+
skip_if_not_installed("rpart")
1720
# Sonar task
1821
tsk = tsk("sonar")
1922
data = tsk$data(cols = tsk$feature_names)
@@ -31,6 +34,8 @@ test_that("MCBoost multicalibrate and predict_probs - CV Predictor", {
3134

3235
test_that("Creating own CV Predictor works with different folds", {
3336
skip_on_cran()
37+
skip_if_not_installed("mlr3learners")
38+
skip_if_not_installed("rpart")
3439
# Sonar task
3540
tsk = tsk("sonar")
3641
data = tsk$data(cols = tsk$feature_names)

tests/testthat/test_mcboost.R

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
skip_if_not_installed("mlr3")
22

33
test_that("MCBoost class instantiation", {
4+
skip_on_cran()
45
mc = MCBoost$new(auditor_fitter = "TreeAuditorFitter")
56
expect_class(mc, "MCBoost")
67
expect_class(mc$auditor_fitter, "AuditorFitter")
78
expect_function(mc$predictor, args = "data")
89

910
})
1011

11-
1212
test_that("MCBoost multicalibrate and predict_probs - ConstantPredictor", {
1313
skip_on_cran()
1414
# Sonar task
@@ -26,7 +26,6 @@ test_that("MCBoost multicalibrate and predict_probs - ConstantPredictor", {
2626
expect_numeric(prds, lower = 0, upper = 1, len = nrow(data))
2727
})
2828

29-
3029
test_that("MCBoost multicalibrate and predict_probs - init_predictor function", {
3130
skip_on_cran()
3231
# Sonar task
@@ -63,7 +62,6 @@ test_that("MCBoost multicalibrate and predict_probs - init_predictor function",
6362

6463
})
6564

66-
6765
test_that("MCBoost multicalibrate and predict_probs - Init trained LearnerPredictor - response", {
6866
skip_on_cran()
6967
# Sonar task
@@ -84,7 +82,6 @@ test_that("MCBoost multicalibrate and predict_probs - Init trained LearnerPredic
8482
expect_numeric(prds, lower = 0, upper = 1, len = nrow(data))
8583
})
8684

87-
8885
test_that("MCBoost multicalibrate and predict_probs - Init trained LearnerPredictor - prob", {
8986
skip_on_cran()
9087
# Breast Cancer task
@@ -105,7 +102,6 @@ test_that("MCBoost multicalibrate and predict_probs - Init trained LearnerPredic
105102
expect_numeric(prds, lower = 0, upper = 1, len = nrow(data))
106103
})
107104

108-
109105
test_that("MCBoost multicalibrate with subpops", {
110106
skip_on_os("solaris")
111107
skip_on_cran()
@@ -163,6 +159,8 @@ test_that("MCBoost multicalibrate with subpops", {
163159
test_that("MCBoost various settings", {
164160
skip_on_cran()
165161
skip_on_os("solaris")
162+
skip_if_not_installed("mlr3learners")
163+
skip_if_not_installed("rpart")
166164
# Sonar task
167165
tsk = tsk("sonar")
168166
data = tsk$data(cols = tsk$feature_names)
@@ -199,7 +197,6 @@ test_that("MCBoost various settings", {
199197
expect_numeric(prd, lower = 0, upper = 1, len = nrow(data))
200198
})
201199

202-
203200
test_that("MCBoost Edge Cases", {
204201
skip_on_cran()
205202
# Sonar task
@@ -231,6 +228,8 @@ test_that("MCBoost Edge Cases", {
231228

232229
test_that("MCBoost args for self-defined init predictor", {
233230
skip_on_os("solaris")
231+
skip_if_not_installed("mlr3learners")
232+
skip_if_not_installed("ranger")
234233
# Sonar task
235234
tsk = tsk("sonar")
236235
data = tsk$data(cols = tsk$feature_names)
@@ -293,6 +292,9 @@ test_that("MCBoost throws error if wrong auditor_fitter", {
293292

294293
test_that("init predictor wrapper works", {
295294
skip_on_cran()
295+
skip_if_not_installed("mlr3learners")
296+
skip_if_not_installed("ranger")
297+
296298
# sonar task
297299
tsk = tsk("sonar")
298300
d = tsk$data(cols = tsk$feature_names, rows = c(1:10, 200:208))
@@ -328,8 +330,11 @@ test_that("init predictor wrapper works", {
328330
})
329331

330332
test_that("mcboost on training data sanity checks", {
331-
skip_on_os("solaris")
332333
skip_on_cran()
334+
skip_on_os("solaris")
335+
skip_if_not_installed("mlr3learners")
336+
skip_if_not_installed("rpart")
337+
333338
tsk = tsk("sonar")
334339
d = tsk$data(cols = tsk$feature_names)
335340
l = tsk$data(cols = tsk$target_names)[[1]]

tests/testthat/test_pipeop_mcboost.R

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ skip_if_not_installed("mlr3")
33
test_that("MCBoost class instantiation", {
44
skip_on_cran()
55
skip_on_os("solaris")
6-
skip_if_not(require("mlr3"))
7-
skip_if_not(require("mlr3pipelines"))
6+
skip_if_not_installed("mlr3")
7+
skip_if_not_installed("mlr3learners")
8+
skip_if_not_installed("mlr3pipelines")
89
gr = gunion(list(
910
"data" = po("nop"),
1011
"prediction" = po("learner_cv", lrn("classif.rpart"))
@@ -24,6 +25,8 @@ test_that("MCBoost class instantiation", {
2425
test_that("pipeop instantiation", {
2526
skip_on_cran()
2627
skip_on_os("solaris")
28+
skip_if_not_installed("mlr3")
29+
skip_if_not_installed("mlr3pipelines")
2730
pop = po("mcboost")
2831
expect_is(pop, "PipeOpMCBoost")
2932
expect_is(pop, "PipeOp")
@@ -34,8 +37,9 @@ test_that("pipeop instantiation", {
3437
test_that("MCBoost ppl", {
3538
skip_on_cran()
3639
skip_on_os("solaris")
37-
skip_if_not(require("mlr3"))
38-
skip_if_not(require("mlr3pipelines"))
40+
skip_if_not_installed("mlr3")
41+
skip_if_not_installed("mlr3learners")
42+
skip_if_not_installed("mlr3pipelines")
3943

4044
l = lrn("classif.featureless")$train(tsk("sonar"))
4145
pp = ppl_mcboost()
@@ -50,6 +54,10 @@ test_that("MCBoost ppl", {
5054
test_that("MCBoostSurv ppl", {
5155
skip_on_cran()
5256
skip_on_os("solaris")
57+
skip_if_not_installed("mlr3")
58+
skip_if_not_installed("mlr3learners")
59+
skip_if_not_installed("mlr3pipelines")
60+
skip_on_os("solaris")
5361
gr = ppl_mcboost(lrn("classif.rpart"))
5462
expect_is(gr, "Graph")
5563
})

tests/testthat/test_predictor.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ test_that("ConstantPredictor", {
1919

2020
test_that("LearnerPredictor - response", {
2121
skip_on_cran()
22+
skip_if_not_installed("mlr3learners")
2223
prd = LearnerPredictor$new(lrn("classif.rpart"))
2324
expect_class(prd, "LearnerPredictor")
2425
prd$fit(iris[1:100,1:4], factor(iris$Species[1:100]))
@@ -29,6 +30,7 @@ test_that("LearnerPredictor - response", {
2930

3031
test_that("LearnerPredictor - probs", {
3132
skip_on_cran()
33+
skip_if_not_installed("mlr3learners")
3234
prd = LearnerPredictor$new(lrn("classif.rpart", predict_type = "prob"))
3335
expect_class(prd, "LearnerPredictor")
3436
prd$fit(iris[51:150,1:4], factor(iris$Species[51:150]))

tests/testthat/test_probrange.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
skip_if_not_installed("mlr3")
2-
31
test_that("ProbRange works", {
42
skip_on_cran()
53
pr = ProbRange$new(0.1, 0.55)

tests/testthat/test_sonar_usecase.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ skip_if_not_installed("mlr3")
22

33
test_that("TreeAuditorFitters work", {
44
skip_on_cran()
5+
skip_if_not_installed("mlr3learners")
56
skip_if_not_installed("rpart")
67
tsk = tsk("sonar")
78
data = tsk$data()[, Class := as.integer(Class) - 1L]

0 commit comments

Comments
 (0)