Skip to content

Commit b27a55a

Browse files
committed
changes for #208
1 parent 82ae63b commit b27a55a

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Some default parameter ranges were updated for SVM, KNN, and MARS models.
44

5+
* [A bug](https://github.com/tidymodels/parsnip/issues/208) was fixed related to using data descriptors and `fit_xy()`.
6+
57
# parsnip 0.0.3.1
68

79
Test case update due to CRAN running extra tests [(#202)](https://github.com/tidymodels/parsnip/issues/202)

R/fit_helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ xy_xy <- function(object, env, control, target = "none", ...) {
7979

8080
# if descriptors are needed, update descr_env with the calculated values
8181
if (requires_descrs(object)) {
82-
data_stats <- get_descr_form(env$formula, env$data)
82+
data_stats <- get_descr_xy(env$x, env$y)
8383
scoped_descrs(data_stats)
8484
}
8585

tests/testthat/test_descriptors.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,21 @@ test_that("can be temporarily overriden at evaluation time", {
249249
})
250250

251251

252+
# ------------------------------------------------------------------------------
253+
254+
test_that("system-level descriptor tests", {
255+
skip_if_not_installed("xgboost")
256+
expect_error(
257+
boost_tree(mode = "regression", mtry = .cols()) %>%
258+
set_engine("xgboost") %>%
259+
fit_xy(x = mtcars[, -1], y = mtcars$mpg),
260+
NA
261+
)
262+
expect_error(
263+
boost_tree(mode = "regression", mtry = .cols()) %>%
264+
set_engine("xgboost") %>%
265+
fit(mpg ~ ., data = mtcars),
266+
NA
267+
)
268+
269+
})

0 commit comments

Comments
 (0)