tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
586 stars 88 forks source link

descriptors with fit_xy #208

Closed topepo closed 5 years ago

topepo commented 5 years ago
library(tidymodels)
#> ── Attaching packages ─────────────────────────────────────────────────────────────────────── tidymodels 0.0.2 ──
#> ✔ broom     0.5.2          ✔ purrr     0.3.2     
#> ✔ dials     0.0.2.9001     ✔ recipes   0.1.6.9000
#> ✔ dplyr     0.8.3          ✔ rsample   0.0.5     
#> ✔ ggplot2   3.2.1          ✔ tibble    2.1.3     
#> ✔ infer     0.4.0.1        ✔ yardstick 0.0.3.9000
#> ✔ parsnip   0.0.3.9000
#> ── Conflicts ────────────────────────────────────────────────────────────────────────── tidymodels_conflicts() ──
#> ✖ purrr::discard()  masks scales::discard()
#> ✖ dplyr::filter()   masks stats::filter()
#> ✖ dplyr::lag()      masks stats::lag()
#> ✖ ggplot2::margin() masks dials::margin()
#> ✖ dials::offset()   masks stats::offset()
#> ✖ recipes::step()   masks stats::step()

boost_tree(mode = "regression", mtry = 3) %>% 
  set_engine("xgboost") %>% 
  fit_xy(x = mtcars[, -1], y = mtcars$mpg)
#> parsnip model object
#> 
#> ##### xgb.Booster
#> raw: 11.2 Kb 
#> call:
#>   xgboost::xgb.train(params = list(eta = 0.3, max_depth = 6, gamma = 0, 
#>     colsample_bytree = 0.3, min_child_weight = 1, subsample = 1), 
#>     data = x, nrounds = 15, verbose = 0, objective = "reg:linear", 
#>     nthread = 1)
#> params (as set within xgb.train):
#>   eta = "0.3", max_depth = "6", gamma = "0", colsample_bytree = "0.3", min_child_weight = "1", subsample = "1", objective = "reg:linear", nthread = "1", silent = "1"
#> xgb.attributes:
#>   niter
#> # of features: 10 
#> niter: 15
#> nfeatures : 10

boost_tree(mode = "regression", mtry = .cols()) %>% 
  set_engine("xgboost") %>% 
  fit_xy(x = mtcars[, -1], y = mtcars$mpg)
#> Error in terms.formula(formula, data = data): argument is not a valid model

Created on 2019-08-29 by the reprex package (v0.2.1)

The issue is that the descriptor generator uses get_descr_form() instead of get_descr_xy()

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.