@@ -35,9 +35,9 @@ test_that('numeric model', {
3535 fit(Sepal.Length ~ . , data = iris_bad , control = ctrl )
3636
3737 num_res <- predict(lm_mod , iris_bad [1 : 11 , - 1 ])
38- expect_equal(num_res , tibble(.pred = rep(NA_real_ , 11 )))
38+ expect_equal(num_res , tibble(.pred = rep(NA_real_ , 1 )))
3939
40- exp_int_res <- tibble(.pred_lower = rep(NA_real_ , 11 ), .pred_upper = rep(NA_real_ , 11 ))
40+ exp_int_res <- tibble(.pred_lower = rep(NA_real_ , 1 ), .pred_upper = rep(NA_real_ , 1 ))
4141 ci_res <- predict(lm_mod , iris_bad [1 : 11 , - 1 ], type = " conf_int" )
4242 expect_equal(ci_res , exp_int_res )
4343
@@ -55,22 +55,22 @@ test_that('classification model', {
5555 fit(Class ~ log(funded_amnt ) + int_rate + big_num , data = lending_club , control = ctrl )
5656
5757 cls_res <- predict(log_reg , lending_club %> % dplyr :: slice(1 : 7 ) %> % dplyr :: select(- Class ))
58- exp_cls_res <- tibble(.pred_class = factor (rep(NA_character_ , 7 ), levels = lvl ))
58+ exp_cls_res <- tibble(.pred_class = factor (rep(NA_character_ , 1 ), levels = lvl ))
5959 expect_equal(cls_res , exp_cls_res )
6060
6161 prb_res <-
6262 predict(log_reg , lending_club %> % dplyr :: slice(1 : 7 ) %> % dplyr :: select(- Class ), type = " prob" )
63- exp_prb_res <- tibble(.pred_bad = rep(NA_real_ , 7 ), .pred_good = rep(NA_real_ , 7 ))
63+ exp_prb_res <- tibble(.pred_bad = rep(NA_real_ , 1 ), .pred_good = rep(NA_real_ , 1 ))
6464 expect_equal(prb_res , exp_prb_res )
6565
6666 ci_res <-
6767 predict(log_reg , lending_club %> % dplyr :: slice(1 : 7 ) %> % dplyr :: select(- Class ), type = " conf_int" )
6868 exp_ci_res <-
6969 tibble(
70- .pred_lower_bad = rep(NA_real_ , 7 ),
71- .pred_upper_bad = rep(NA_real_ , 7 ),
72- .pred_lower_good = rep(NA_real_ , 7 ),
73- .pred_upper_good = rep(NA_real_ , 7 )
70+ .pred_lower_bad = rep(NA_real_ , 1 ),
71+ .pred_upper_bad = rep(NA_real_ , 1 ),
72+ .pred_lower_good = rep(NA_real_ , 1 ),
73+ .pred_upper_good = rep(NA_real_ , 1 )
7474 )
7575 expect_equal(ci_res , exp_ci_res )
7676})
0 commit comments