Skip to content

Commit eee4b5c

Browse files
committed
fixed a few test cases
1 parent e2215bc commit eee4b5c

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

tests/testthat/test_linear_reg_stan.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ iris_bad_form <- as.formula(Species ~ term)
1111
iris_basic <- linear_reg() %>%
1212
set_engine("stan", seed = 10, chains = 1)
1313

14-
ctrl <- fit_control(verbosity = 0, catch = FALSE)
15-
caught_ctrl <- fit_control(verbosity = 0, catch = TRUE)
16-
quiet_ctrl <- fit_control(verbosity = 0, catch = TRUE)
14+
ctrl <- fit_control(verbosity = 0L, catch = FALSE)
15+
caught_ctrl <- fit_control(verbosity = 0L, catch = TRUE)
16+
quiet_ctrl <- fit_control(verbosity = 0L, catch = TRUE)
1717

1818
# ------------------------------------------------------------------------------
1919

tests/testthat/test_logistic_reg_stan.R

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ test_that('stan_glm execution', {
2929
lc_basic,
3030
funded_amnt ~ term,
3131
data = lending_club,
32-
engine = "stan",
3332
control = ctrl
3433
)
3534
)
3635

3736
stan_xy_catch <- fit_xy(
3837
lc_basic,
39-
engine = "stan",
4038
control = caught_ctrl,
4139
x = lending_club[, num_pred],
4240
y = lending_club$total_bal_il
@@ -53,7 +51,6 @@ test_that('stan_glm prediction', {
5351
xy_fit <- fit_xy(
5452
logistic_reg() %>%
5553
set_engine("stan", seed = 1333, chains = 1),
56-
engine = "stan",
5754
control = ctrl,
5855
x = lending_club[, num_pred],
5956
y = lending_club$Class
@@ -74,7 +71,6 @@ test_that('stan_glm prediction', {
7471
set_engine("stan", seed = 1333, chains = 1),
7572
Class ~ log(funded_amnt) + int_rate,
7673
data = lending_club,
77-
engine = "stan",
7874
control = ctrl
7975
)
8076

@@ -96,7 +92,6 @@ test_that('stan_glm probability', {
9692
xy_fit <- fit_xy(
9793
logistic_reg() %>%
9894
set_engine("stan", seed = 1333, chains = 1),
99-
engine = "stan",
10095
control = ctrl,
10196
x = lending_club[, num_pred],
10297
y = lending_club$Class
@@ -115,7 +110,6 @@ test_that('stan_glm probability', {
115110
set_engine("stan", seed = 1333, chains = 1),
116111
Class ~ log(funded_amnt) + int_rate,
117112
data = lending_club,
118-
engine = "stan",
119113
control = ctrl
120114
)
121115

@@ -137,7 +131,6 @@ test_that('stan intervals', {
137131
set_engine("stan", seed = 1333, chains = 1),
138132
Class ~ log(funded_amnt) + int_rate,
139133
data = lending_club,
140-
engine = "stan",
141134
control = ctrl
142135
)
143136

tests/testthat/test_mlp_keras.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ context("simple neural network execution with keras")
99
num_pred <- names(iris)[1:4]
1010

1111
iris_keras <-
12-
mlp(mode = "classification", hidden_units = 2) %>%
13-
set_engine("keras", verbose = 0, epochs = 10)
12+
mlp(mode = "classification", hidden_units = 2, epochs = 10) %>%
13+
set_engine("keras", verbose = 0)
1414

1515
ctrl <- fit_control(verbosity = 1, catch = FALSE)
1616
caught_ctrl <- fit_control(verbosity = 1, catch = TRUE)
@@ -130,8 +130,8 @@ mtcars <- as.data.frame(scale(mtcars))
130130

131131
num_pred <- names(mtcars)[3:6]
132132

133-
car_basic <- mlp(mode = "regression") %>%
134-
set_engine("keras", verbose = 0, epochs = 10)
133+
car_basic <- mlp(mode = "regression", epochs = 10) %>%
134+
set_engine("keras", verbose = 0)
135135

136136
bad_keras_reg <-
137137
mlp(mode = "regression") %>%
@@ -176,8 +176,8 @@ test_that('keras regression prediction', {
176176
skip_if_not_installed("keras")
177177

178178
xy_fit <- parsnip::fit_xy(
179-
mlp(mode = "regression", hidden_units = 2) %>%
180-
set_engine("keras", epochs = 500, penalty = .1, verbose = 0),
179+
mlp(mode = "regression", hidden_units = 2, epochs = 500, penalty = .1) %>%
180+
set_engine("keras", verbose = 0),
181181
x = mtcars[, c("cyl", "disp")],
182182
y = mtcars$mpg,
183183
control = ctrl
@@ -211,8 +211,8 @@ test_that('multivariate nnet formula', {
211211
skip_if_not_installed("keras")
212212

213213
nnet_form <-
214-
mlp(mode = "regression", hidden_units = 3) %>%
215-
set_engine("keras", penalty = 0.01, verbose = 0) %>%
214+
mlp(mode = "regression", hidden_units = 3, penalty = 0.01) %>%
215+
set_engine("keras", verbose = 0) %>%
216216
parsnip::fit(
217217
cbind(V1, V2, V3) ~ .,
218218
data = nn_dat[-(1:5),]
@@ -226,8 +226,8 @@ test_that('multivariate nnet formula', {
226226
keras::backend()$clear_session()
227227

228228
nnet_xy <-
229-
mlp(mode = "regression", hidden_units = 3) %>%
230-
set_engine("keras", penalty = 0.01, verbose = 0) %>%
229+
mlp(mode = "regression", hidden_units = 3, penalty = 0.01) %>%
230+
set_engine("keras", verbose = 0) %>%
231231
parsnip::fit_xy(
232232
x = nn_dat[-(1:5), -(1:3)],
233233
y = nn_dat[-(1:5), 1:3 ]

0 commit comments

Comments
 (0)