Skip to content

Commit 01aecfe

Browse files
committed
Update tests for consistent name removal from vectors
1 parent 4931d0d commit 01aecfe

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tests/testthat/test_logistic_reg.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ test_that('glm probabilities', {
300300
control = ctrl
301301
)
302302

303-
xy_pred <- predict(classes_xy$fit, newdata = lending_club[1:7, num_pred], type = "response")
303+
xy_pred <- unname(predict(classes_xy$fit,
304+
newdata = lending_club[1:7, num_pred],
305+
type = "response"))
304306
xy_pred <- tibble(.pred_bad = 1 - xy_pred, .pred_good = xy_pred)
305307
expect_equal(xy_pred, predict(classes_xy, lending_club[1:7, num_pred], type = "prob"))
306308

tests/testthat/test_logistic_reg_glmnet.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ test_that('glmnet probabilities, one lambda', {
251251
form_mat <- form_mat[1:7, -1]
252252

253253
form_pred <-
254-
predict(res_form$fit,
254+
unname(predict(res_form$fit,
255255
newx = form_mat,
256-
s = 0.1, type = "response")[, 1]
256+
s = 0.1, type = "response")[, 1])
257257
form_pred <- tibble(.pred_bad = 1 - form_pred, .pred_good = form_pred)
258258

259259
expect_equal(
@@ -358,7 +358,8 @@ test_that('glmnet probabilities, no lambda', {
358358

359359
expect_equal(
360360
mult_pred,
361-
multi_predict(xy_fit, lending_club[1:7, num_pred], type = "prob") %>% unnest()
361+
multi_predict(xy_fit, lending_club[1:7, num_pred], type = "prob") %>%
362+
unnest(cols = c(.pred))
362363
)
363364

364365
res_form <- fit(

0 commit comments

Comments
 (0)