Skip to content

Commit ea8f1ff

Browse files
authored
No long double changes for CRAN submission (#203)
* better handling of unknown modes * version sent to cran
1 parent 9e2bc07 commit ea8f1ff

File tree

7 files changed

+43
-10
lines changed

7 files changed

+43
-10
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Package: parsnip
2-
Version: 0.0.3.9000
2+
Version: 0.0.3.1
33
Title: A Common API to Modeling and Analysis Functions
44
Description: A common interface is provided to allow users to specify a model without having to remember the different argument names across different functions or computational engines (e.g. 'R', 'Spark', 'Stan', etc).
55
Authors@R: c(
6-
person("Max", "Kuhn", , "[email protected]", c("aut", "cre")),
7-
person("Davis", "Vaughan", , "[email protected]", c("aut")),
6+
person(given = "Max", family = "Kuhn", email = "[email protected]", role = c("aut", "cre")),
7+
person(given = "Davis", family = "Vaughan", email = "[email protected]", role = c("aut")),
88
person("RStudio", role = "cph"))
99
Maintainer: Max Kuhn <[email protected]>
1010
URL: https://tidymodels.github.io/parsnip

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# parsnip 0.0.3.9000
1+
# parsnip 0.0.3.1
2+
3+
Test case update due to CRAN running extra tests [(#202)](https://github.com/tidymodels/parsnip/issues/202)
4+
25

36
# parsnip 0.0.3
47

R/fit.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ fit.model_spec <-
9494
control = fit_control(),
9595
...
9696
) {
97+
if (object$mode == "unknown") {
98+
stop("Please set the mode in the model specification.", call. = FALSE)
99+
}
97100
dots <- quos(...)
98101
if (is.null(object$engine)) {
99102
eng_vals <- possible_engines(object)
@@ -183,6 +186,7 @@ fit_xy.model_spec <-
183186
control = fit_control(),
184187
...
185188
) {
189+
object <- check_mode(object, levels(y))
186190
dots <- quos(...)
187191
if (is.null(object$engine)) {
188192
eng_vals <- possible_engines(object)

tests/testthat/test_aaaa.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
library(testthat)
66

7-
context("setting keras environment\n")
7+
context("setting keras environment")
88

99
Sys.setenv(TF_CPP_MIN_LOG_LEVEL = '3')
10-
try(keras:::backend(), silent = TRUE)
10+
k_bk <- try(keras:::backend(), silent = TRUE)

tests/testthat/test_fit_interfaces.R

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,22 @@ test_that('single column df for issue #129', {
6060
expect_equal(coef(lm1), coef(lm3))
6161
expect_equal(coef(lm2), coef(lm3))
6262
})
63+
64+
# ------------------------------------------------------------------------------
65+
66+
test_that('unknown modes', {
67+
mars_spec <- set_engine(mars(), "earth")
68+
expect_error(
69+
fit(mars_spec, am ~ ., data = mtcars),
70+
"Please set the mode in the model specification."
71+
)
72+
expect_error(
73+
fit_xy(mars_spec, x = mtcars[, -1], y = mtcars[,1]),
74+
regexp = NA
75+
)
76+
expect_error(
77+
fit_xy(mars_spec, x = lending_club[,1:2], y = lending_club$Class),
78+
regexp = NA
79+
)
80+
})
81+

tests/testthat/test_linear_reg_stan.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ quiet_ctrl <- fit_control(verbosity = 0L, catch = TRUE)
1919

2020
test_that('stan_glm execution', {
2121
skip_if_not_installed("rstanarm")
22+
skip_on_cran()
2223

2324
expect_error(
2425
res <- fit(
@@ -56,6 +57,7 @@ test_that('stan_glm execution', {
5657

5758
test_that('stan prediction', {
5859
skip_if_not_installed("rstanarm")
60+
skip_on_cran()
5961

6062
uni_pred <- c(5.01531691055198, 4.6896592504705, 4.74907435900005, 4.82563873798984,
6163
5.08044844256827)
@@ -84,6 +86,7 @@ test_that('stan prediction', {
8486

8587
test_that('stan intervals', {
8688
skip_if_not_installed("rstanarm")
89+
skip_on_cran()
8790

8891
res_xy <- fit_xy(
8992
linear_reg() %>%
@@ -115,15 +118,15 @@ test_that('stan intervals', {
115118
pi_upper <- c(5.59783267637042, 5.25976504318669, 5.33296516452929, 5.41050668003565,
116119
5.66355828140989)
117120

118-
expect_equivalent(confidence_parsnip$.pred_lower, ci_lower)
119-
expect_equivalent(confidence_parsnip$.pred_upper, ci_upper)
121+
expect_equivalent(confidence_parsnip$.pred_lower, ci_lower, tolerance = 1e-2)
122+
expect_equivalent(confidence_parsnip$.pred_upper, ci_upper, tolerance = 1e-2)
120123

121124
expect_equivalent(prediction_parsnip$.pred_lower,
122125
pi_lower,
123-
tol = 0.01)
126+
tolerance = 1e-2)
124127
expect_equivalent(prediction_parsnip$.pred_upper,
125128
pi_upper,
126-
tol = 0.01)
129+
tolerance = 1e-2)
127130
})
128131

129132

tests/testthat/test_logistic_reg_stan.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ quiet_ctrl <- fit_control(verbosity = 0, catch = TRUE)
2323

2424
test_that('stan_glm execution', {
2525
skip_if_not_installed("rstanarm")
26+
skip_on_cran()
2627

2728
expect_error(
2829
res <- fit(
@@ -47,6 +48,7 @@ test_that('stan_glm execution', {
4748

4849
test_that('stan_glm prediction', {
4950
skip_if_not_installed("rstanarm")
51+
skip_on_cran()
5052

5153
xy_fit <- fit_xy(
5254
logistic_reg() %>%
@@ -80,6 +82,7 @@ test_that('stan_glm prediction', {
8082

8183
test_that('stan_glm probability', {
8284
skip_if_not_installed("rstanarm")
85+
skip_on_cran()
8386

8487
xy_fit <- fit_xy(
8588
logistic_reg() %>%
@@ -135,6 +138,7 @@ test_that('stan_glm probability', {
135138

136139
test_that('stan intervals', {
137140
skip_if_not_installed("rstanarm")
141+
skip_on_cran()
138142

139143
res_form <- fit(
140144
logistic_reg() %>%

0 commit comments

Comments
 (0)