Skip to content

descriptors with fit_xy #208

@topepo

Description

@topepo
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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions