@@ -2,8 +2,7 @@ test_that("sparse tibble can be passed to `fit()", {
22 skip_if_not_installed(" xgboost" )
33 withr :: local_options(" sparsevctrs.verbose_materialize" = 3 )
44
5- hotel_data <- sparse_hotel_rates()
6- hotel_data <- sparsevctrs :: coerce_to_sparse_tibble(hotel_data )
5+ hotel_data <- sparse_hotel_rates(tibble = TRUE )
76
87 spec <- boost_tree() %> %
98 set_mode(" regression" ) %> %
@@ -54,11 +53,7 @@ test_that("sparse matrix can be passed to `fit()", {
5453test_that(" sparse tibble can be passed to `fit_xy()" , {
5554 skip_if_not_installed(" xgboost" )
5655
57- hotel_data <- sparse_hotel_rates()
58- hotel_data <- sparsevctrs :: coerce_to_sparse_tibble(hotel_data )
59-
60- # materialize outcome
61- hotel_data $ avg_price_per_room <- hotel_data $ avg_price_per_room []
56+ hotel_data <- sparse_hotel_rates(tibble = TRUE )
6257
6358 withr :: local_options(" sparsevctrs.verbose_materialize" = 3 )
6459
@@ -108,11 +103,7 @@ test_that("sparse matrices can be passed to `fit_xy()", {
108103test_that(" sparse tibble can be passed to `predict()" , {
109104 skip_if_not_installed(" ranger" )
110105
111- hotel_data <- sparse_hotel_rates()
112- hotel_data <- sparsevctrs :: coerce_to_sparse_tibble(hotel_data )
113-
114- # materialize outcome
115- hotel_data $ avg_price_per_room <- hotel_data $ avg_price_per_room []
106+ hotel_data <- sparse_hotel_rates(tibble = TRUE )
116107
117108 withr :: local_options(" sparsevctrs.verbose_materialize" = 3 )
118109
@@ -191,8 +182,7 @@ test_that("sparse data work with xgboost engine", {
191182 predict(tree_fit , hotel_data )
192183 )
193184
194- hotel_data <- sparsevctrs :: coerce_to_sparse_tibble(hotel_data )
195-
185+ hotel_data <- sparse_hotel_rates(tibble = TRUE )
196186
197187 expect_snapshot(
198188 error = TRUE ,
@@ -203,11 +193,6 @@ test_that("sparse data work with xgboost engine", {
203193 predict(tree_fit , hotel_data )
204194 )
205195
206- # materialize outcome
207- withr :: local_options(" sparsevctrs.verbose_materialize" = NULL )
208- hotel_data $ avg_price_per_room <- hotel_data $ avg_price_per_room []
209- withr :: local_options(" sparsevctrs.verbose_materialize" = 3 )
210-
211196 expect_no_error(
212197 tree_fit <- fit_xy(spec , x = hotel_data [, - 1 ], y = hotel_data [, 1 ])
213198 )
0 commit comments