Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludvig committed Jul 14, 2022
2 parents 65b5174 + 07eed67 commit df28b90
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 26 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: cvms
Title: Cross-Validation for Model Selection
Version: 1.3.3.9000
Version: 1.3.4
Authors@R:
c(person(given = "Ludvig Renbo",
family = "Olsen",
Expand Down Expand Up @@ -55,6 +55,7 @@ Suggests:
ggnewscale (>= 0.4.3),
groupdata2 (>= 1.4.1),
knitr,
merDeriv (>= 0.2-4),
nnet (>= 7.3-12),
randomForest (>= 4.6-14),
rmarkdown,
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

# cvms 1.3.3.9000
# cvms 1.3.4

* Fixes tests for CRAN.

* Adds `merDeriv` as suggested package.

# cvms 1.3.3

Expand Down
66 changes: 48 additions & 18 deletions tests/testthat/test_baseline.R
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,14 @@ test_that("gaussian evaluations of random effects models are correct in baseline
tolerance = 1e-4)
expect_equal(
all_coeffs[["std.error"]],
c(7.15632, NA, NA, 5.5312, NA, NA, 8.97275, NA, NA, 4.96158, NA,
NA, 7.05688, NA, NA, 10.2739, NA, NA, 6.5612, NA, NA, 9.73186,
NA, NA, 10.77985, NA, NA, 5.86883, NA, NA),
c(7.15631722929513, 8.48017078596171, 3.32220364038992, 5.53120433851552,
5.6642976362218, 2.25389751408461, 8.97275331112187, 11.3857986359196,
5.42155778061848, 4.96158288393548, 5.24814564894732, 2.47708793486519,
7.05688044109226, 6.80599557763085, 2.44460604383921, 10.2738954220409,
9.3566019868576, 2.37405616559033, 6.56119896982287, 7.00187724900024,
2.67291574649631, 9.73185625725407, 9.07113095976679, 2.73321585096119,
10.7798459438635, 9.97743399907886, 3.00837168723259, 5.86883171896131,
5.58366565229798, 2.08319768342238),
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.level"]],
Expand All @@ -1125,15 +1130,25 @@ test_that("gaussian evaluations of random effects models are correct in baseline
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.low"]],
c(-1.34283, NA, NA, 21.52729, NA, NA, 16.01983, NA, NA, 13.919,
NA, NA, 12.04505, NA, NA, 15.11557, NA, NA, 18.66346, NA, NA,
14.53101, NA, NA, 11.92119, NA, NA, 12.11779, NA, NA),
c(-1.34282744691279, 1.27386538040635, 3.65595044257592, 21.5272884598991,
2.10706150007808, 6.02772189002962, 16.0198275271794, 1.54493287924856,
7.79951776760785, 13.9189969554157, 1.75521843225081, 2.74168881162613,
12.0450475999266, 3.32735374149643, 3.4650146393119, 15.1155676968666,
5.73749350704645, 7.33249168749023, 18.6634644982617, 2.19342388622354,
5.96805635026065, 14.5310088047755, 5.0541486113636, 8.44222372952845,
11.9211926362553, 5.72553547803716, 8.04194093825517, 12.1177908826813,
2.86948523148235, 3.54513955526967),
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.high"]],
c(60.23947, NA, NA, 46.5522, NA, NA, 65.84454, NA, NA, 45.49894,
NA, NA, 51.23113, NA, NA, 60.34095, NA, NA, 49.693, NA, NA,
57.37035, NA, NA, 60.6926, NA, NA, 42.29042, NA, NA),
c(60.2394682762468, 58.9776840264608, 18.1135448112533, 46.5521954864459,
31.7776340871192, 15.1802497890285, 65.8445415488026, 81.8241896481276,
30.7584161713846, 45.4989391900944, 29.9556977953848, 13.5144521340807,
51.2311299171999, 36.9283411378221, 13.8312651699865, 60.3409504173574,
50.0110277516517, 16.9117984896506, 49.6930049053992, 40.4381415401269,
16.9266142042435, 57.3703512094978, 48.7229715372203, 19.4707153600945,
60.6926040677994, 53.49790912956, 20.2584602694038, 42.2904153090177,
30.1653776868507, 12.2439623269154),
tolerance = 1e-4)
expect_equal(
all_coeffs[["statistic"]],
Expand Down Expand Up @@ -1395,9 +1410,14 @@ test_that("gaussian evaluations of random effects models are correct with REML F
tolerance = 1e-4)
expect_equal(
all_coeffs[["std.error"]],
c(5.00668, NA, NA, 4.58126, NA, NA, 7.41575, NA, NA, 4.11851, NA,
NA, 5.86298, NA, NA, 8.40641, NA, NA, 5.47687, NA, NA, 8.01517,
NA, NA, 8.84394, NA, NA, 4.79166, NA, NA),
c(5.00667887999703, 5.67371825188572, 3.32263054737512, 4.58125952668684,
4.19962069675716, 2.23902846895305, 7.4157534194802, 9.40523002404368,
5.22228218871595, 4.11850585776279, 3.92278892473836, 2.40582757012123,
5.86297959144672, 4.82362962007409, 2.40174657096886, 8.40640786916794,
6.41710541301027, 2.37215499333295, 5.47687326594097, 4.98399903152422,
2.61097972219224, 8.01516995843001, 6.33568334015868, 2.72644466961516,
8.84393766439164, 6.93470544419571, 3.00359441565683, 4.79166391324045,
3.95574719227331, 2.08166583997345),
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.level"]],
Expand All @@ -1407,15 +1427,25 @@ test_that("gaussian evaluations of random effects models are correct with REML F
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.low"]],
c(7.50556, NA, NA, 23.95681, NA, NA, 20.65221, NA, NA, 16.83729,
NA, NA, 15.50822, NA, NA, 19.16343, NA, NA, 21.38705, NA, NA,
18.32099, NA, NA, 16.27282, NA, NA, 14.79787, NA, NA),
c(7.5055635091569, 0.46936052606292, 3.68244920326646, 23.9568134523162,
1.65364927534353, 6.00610431660554, 20.6522095649089, 0.682793897696677,
7.78255751654273, 16.8372929040608, 1.38894433687881, 2.71959079455526,
15.5082176576566, 3.01936677556473, 3.43474719144677, 19.1634263807258,
5.3236524900518, 7.32915051912752, 21.3870490121703, 1.89133471569308,
5.93003670321845, 18.3209851742201, 4.59865828520289, 8.42599036674567,
16.2728226558001, 5.21079259307738, 8.03150734947051, 14.7978731028873,
2.46897286078753, 3.54581770261687),
tolerance = 1e-4)
expect_equal(
all_coeffs[["conf.high"]],
c(50.58956, NA, NA, 44.68387, NA, NA, 61.83107, NA, NA, 43.05114,
NA, NA, 48.0647, NA, NA, 56.16818, NA, NA, 47.28854, NA, NA,
53.60353, NA, NA, 56.28558, NA, NA, 39.4326, NA, NA),
c(50.5895646091533, 48.8439653196076, 18.1302694700696, 44.6838715581805,
23.366460023273, 15.0969356177559, 61.8310741306481, 85.3790886729535,
29.8284029460688, 43.0511404047138, 22.17813974328, 13.1576934421859,
48.0646996347502, 25.7625665742604, 13.6109854945425, 56.1681843201583,
34.2737942870217, 16.9006519912674, 47.2885437072587, 27.8779371562027,
16.6240922819864, 53.6035254424537, 33.7550247871271, 19.426912395414,
56.2855765254888, 36.9541620366811, 20.2284566698823, 39.4326015385872,
21.1294251635629, 12.2376231801648),
tolerance = 1e-4)
expect_equal(
all_coeffs[["statistic"]],
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test_cross_validate.R
Original file line number Diff line number Diff line change
Expand Up @@ -2217,9 +2217,9 @@ test_that("that singular fit messages are caught, counted and messaged about in
fixed = TRUE)
expect_equal(
xpectr::strip(side_effects_12059[['messages']]),
xpectr::strip(c("\n---\ncross_validate(): boundary (singular) fit: see ?isSingular\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 1\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n",
"\n---\ncross_validate(): boundary (singular) fit: see ?isSingular\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 2\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n",
"\n---\ncross_validate(): boundary (singular) fit: see ?isSingular\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 4\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n")),
xpectr::strip(c("---\ncross_validate(): boundary (singular) fit: see help('isSingular')\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 1\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n\n",
"---\ncross_validate(): boundary (singular) fit: see help('isSingular')\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 2\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n\n",
"---\ncross_validate(): boundary (singular) fit: see help('isSingular')\nNote: Boundary (Singular) Fit Message\nFor:\nFormula: diagnosis~score+(1|participant)+(1|session)\nFold column: .folds\nFold: 4\nHyperparameters: REML : FALSE, control : list(list(optimizer = c(\"bobyqa\", \"Nelder_Mead\"), restart_edge = FALSE, boundary.tol = 1e-05, calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(check.nobs.vs.rankZ = \"ignore\", check.nobs.vs.nlev = \"stop\", check.nlev.gtreq.5 = \"ignore\", check.nlev.gtr.1 = \"stop\", check.nobs.vs.nRE = \"stop\", check.rankX = \"message+drop.cols\", check.scaleX = \"warning\", check.formula.LHS = \"stop\", check.response.not.const = \"stop\"), checkConv = list(check.conv.grad = list(action = \"warning\", tol = 0.002, \n relTol = NULL), check.conv.singular = list(action = \"message\", tol = 1e-04), check.conv.hess = list(action = \"warning\", tol = 1e-06)), optCtrl = list(), tolPwrss = 1e-07, compDev = TRUE, nAGQ0initStep = TRUE)), model_verbose : FALSE, family : binomial, is_special_fn : TRUE\n\n")),
fixed = TRUE)
# Assigning output
output_12059 <- xpectr::suppress_mw(cross_validate(
Expand Down Expand Up @@ -2371,7 +2371,7 @@ test_that("that singular fit messages are caught, counted and messaged about in
# Can't expect the same warnings on mac and ubuntu
# so we just check that the singular fit message is there
expect_true(
"boundary (singular) fit: see ?isSingular\n" %in%
"boundary (singular) fit: see help('isSingular')\n" %in%
CVbinom$`Warnings and Messages`[[1]]$Message
)
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_example_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ test_that("the expected output is returned from preprocess_functions() functions
standardized_test[["diagnosis"]] <- (standardized_test[["diagnosis"]] - train_mean_diagnosis) / train_sd_diagnosis

# Test
expect_identical(standardized_by_fn[["train"]], standardized_train)
expect_identical(standardized_by_fn[["test"]], standardized_test)
expect_equal(standardized_by_fn[["train"]], standardized_train)
expect_equal(standardized_by_fn[["test"]], standardized_test)
expect_equal(
standardized_by_fn[["parameters"]]$Measure,
c("Mean", "SD")
Expand Down

0 comments on commit df28b90

Please sign in to comment.