Skip to content

Commit a7ccbf4

Browse files
committed
use better names for fitted models
1 parent efeafa4 commit a7ccbf4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tests/testthat/_snaps/sparsevctrs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# sparse tibble can be passed to `fit() - supported
22

33
Code
4-
lm_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
4+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
55
Condition
66
Error in `.convert_form_to_xy_fit()`:
77
! Sparse data cannot be used with formula interface. Please use `fit_xy()` instead.
@@ -17,7 +17,7 @@
1717
# sparse matrix can be passed to `fit() - supported
1818

1919
Code
20-
lm_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
20+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
2121
Condition
2222
Error in `.convert_form_to_xy_fit()`:
2323
! Sparse data cannot be used with formula interface. Please use `fit_xy()` instead.
@@ -65,7 +65,7 @@
6565
# sparse data work with xgboost engine
6666

6767
Code
68-
tree_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
68+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
6969
Condition
7070
Error in `.convert_form_to_xy_fit()`:
7171
! Sparse data cannot be used with formula interface. Please use `fit_xy()` instead.

tests/testthat/test-sparsevctrs.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test_that("sparse tibble can be passed to `fit() - supported", {
1010

1111
expect_snapshot(
1212
error = TRUE,
13-
lm_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
13+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
1414
)
1515
})
1616

@@ -38,7 +38,7 @@ test_that("sparse matrix can be passed to `fit() - supported", {
3838

3939
expect_snapshot(
4040
error = TRUE,
41-
lm_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
41+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
4242
)
4343

4444
})
@@ -66,7 +66,7 @@ test_that("sparse tibble can be passed to `fit_xy() - supported", {
6666
set_engine("xgboost")
6767

6868
expect_no_error(
69-
lm_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
69+
xgb_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
7070
)
7171
})
7272

@@ -93,7 +93,7 @@ test_that("sparse matrices can be passed to `fit_xy() - supported", {
9393
set_engine("xgboost")
9494

9595
expect_no_error(
96-
lm_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
96+
xgb_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
9797
)
9898
})
9999

@@ -190,30 +190,30 @@ test_that("sparse data work with xgboost engine", {
190190
hotel_data <- sparse_hotel_rates()
191191

192192
expect_no_error(
193-
tree_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
193+
xgb_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
194194
)
195195

196196
expect_no_error(
197-
predict(tree_fit, hotel_data)
197+
predict(xgb_fit, hotel_data)
198198
)
199199

200200
hotel_data <- sparse_hotel_rates(tibble = TRUE)
201201

202202
expect_snapshot(
203203
error = TRUE,
204-
tree_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
204+
xgb_fit <- fit(spec, avg_price_per_room ~ ., data = hotel_data)
205205
)
206206

207207
expect_no_error(
208-
predict(tree_fit, hotel_data)
208+
predict(xgb_fit, hotel_data)
209209
)
210210

211211
expect_no_error(
212-
tree_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
212+
xgb_fit <- fit_xy(spec, x = hotel_data[, -1], y = hotel_data[, 1])
213213
)
214214

215215
expect_no_error(
216-
predict(tree_fit, hotel_data)
216+
predict(xgb_fit, hotel_data)
217217
)
218218
})
219219

0 commit comments

Comments
 (0)