Skip to content

No long double changes for CRAN submission #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: parsnip
Version: 0.0.3.9000
Version: 0.0.3.1
Title: A Common API to Modeling and Analysis Functions
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).
Authors@R: c(
person("Max", "Kuhn", , "[email protected]", c("aut", "cre")),
person("Davis", "Vaughan", , "[email protected]", c("aut")),
person(given = "Max", family = "Kuhn", email = "[email protected]", role = c("aut", "cre")),
person(given = "Davis", family = "Vaughan", email = "[email protected]", role = c("aut")),
person("RStudio", role = "cph"))
Maintainer: Max Kuhn <[email protected]>
URL: https://tidymodels.github.io/parsnip
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# parsnip 0.0.3.9000
# parsnip 0.0.3.1

Test case update due to CRAN running extra tests [(#202)](https://github.com/tidymodels/parsnip/issues/202)


# parsnip 0.0.3

Expand Down
4 changes: 4 additions & 0 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ fit.model_spec <-
control = fit_control(),
...
) {
if (object$mode == "unknown") {
stop("Please set the mode in the model specification.", call. = FALSE)
}
dots <- quos(...)
if (is.null(object$engine)) {
eng_vals <- possible_engines(object)
Expand Down Expand Up @@ -183,6 +186,7 @@ fit_xy.model_spec <-
control = fit_control(),
...
) {
object <- check_mode(object, levels(y))
dots <- quos(...)
if (is.null(object$engine)) {
eng_vals <- possible_engines(object)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_aaaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

library(testthat)

context("setting keras environment\n")
context("setting keras environment")

Sys.setenv(TF_CPP_MIN_LOG_LEVEL = '3')
try(keras:::backend(), silent = TRUE)
k_bk <- try(keras:::backend(), silent = TRUE)
19 changes: 19 additions & 0 deletions tests/testthat/test_fit_interfaces.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ test_that('single column df for issue #129', {
expect_equal(coef(lm1), coef(lm3))
expect_equal(coef(lm2), coef(lm3))
})

# ------------------------------------------------------------------------------

test_that('unknown modes', {
mars_spec <- set_engine(mars(), "earth")
expect_error(
fit(mars_spec, am ~ ., data = mtcars),
"Please set the mode in the model specification."
)
expect_error(
fit_xy(mars_spec, x = mtcars[, -1], y = mtcars[,1]),
regexp = NA
)
expect_error(
fit_xy(mars_spec, x = lending_club[,1:2], y = lending_club$Class),
regexp = NA
)
})

11 changes: 7 additions & 4 deletions tests/testthat/test_linear_reg_stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ quiet_ctrl <- fit_control(verbosity = 0L, catch = TRUE)

test_that('stan_glm execution', {
skip_if_not_installed("rstanarm")
skip_on_cran()

expect_error(
res <- fit(
Expand Down Expand Up @@ -56,6 +57,7 @@ test_that('stan_glm execution', {

test_that('stan prediction', {
skip_if_not_installed("rstanarm")
skip_on_cran()

uni_pred <- c(5.01531691055198, 4.6896592504705, 4.74907435900005, 4.82563873798984,
5.08044844256827)
Expand Down Expand Up @@ -84,6 +86,7 @@ test_that('stan prediction', {

test_that('stan intervals', {
skip_if_not_installed("rstanarm")
skip_on_cran()

res_xy <- fit_xy(
linear_reg() %>%
Expand Down Expand Up @@ -115,15 +118,15 @@ test_that('stan intervals', {
pi_upper <- c(5.59783267637042, 5.25976504318669, 5.33296516452929, 5.41050668003565,
5.66355828140989)

expect_equivalent(confidence_parsnip$.pred_lower, ci_lower)
expect_equivalent(confidence_parsnip$.pred_upper, ci_upper)
expect_equivalent(confidence_parsnip$.pred_lower, ci_lower, tolerance = 1e-2)
expect_equivalent(confidence_parsnip$.pred_upper, ci_upper, tolerance = 1e-2)

expect_equivalent(prediction_parsnip$.pred_lower,
pi_lower,
tol = 0.01)
tolerance = 1e-2)
expect_equivalent(prediction_parsnip$.pred_upper,
pi_upper,
tol = 0.01)
tolerance = 1e-2)
})


Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test_logistic_reg_stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ quiet_ctrl <- fit_control(verbosity = 0, catch = TRUE)

test_that('stan_glm execution', {
skip_if_not_installed("rstanarm")
skip_on_cran()

expect_error(
res <- fit(
Expand All @@ -47,6 +48,7 @@ test_that('stan_glm execution', {

test_that('stan_glm prediction', {
skip_if_not_installed("rstanarm")
skip_on_cran()

xy_fit <- fit_xy(
logistic_reg() %>%
Expand Down Expand Up @@ -80,6 +82,7 @@ test_that('stan_glm prediction', {

test_that('stan_glm probability', {
skip_if_not_installed("rstanarm")
skip_on_cran()

xy_fit <- fit_xy(
logistic_reg() %>%
Expand Down Expand Up @@ -135,6 +138,7 @@ test_that('stan_glm probability', {

test_that('stan intervals', {
skip_if_not_installed("rstanarm")
skip_on_cran()

res_form <- fit(
logistic_reg() %>%
Expand Down