Code
splits <- embed:::cart_binning(sample(sim_tr_cls$x), "x", sim_tr_cls$class,
cost_complexity = 0.01, tree_depth = 5, min_n = 10)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'x', which will not be binned.
Code
splits <- embed:::cart_binning(sample(sim_tr_reg$x), "potato", sim_tr_reg$y,
cost_complexity = 0.01, tree_depth = 5, min_n = 10)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'potato', which will not be binned.
Code
cart_rec <- recipe(class ~ ., data = sim_tr_cls) %>% step_discretize_cart(
all_predictors(), outcome = "class") %>% prep()
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Code
cart_rec <- recipe(y ~ ., data = sim_tr_reg) %>% step_discretize_cart(
all_predictors(), outcome = "y") %>% prep()
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Code
cart_rec <- recipe(y ~ ., data = tmp) %>% step_discretize_cart(all_predictors(),
outcome = "y") %>% prep()
Condition
Error in `step_discretize_cart()`:
Caused by error in `prep()`:
x All columns selected for the step should be double or integer.
* 1 factor variable found: `w`
Code
cart_rec <- prep(cart_rec)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Code
cart_rec <- recipe(class ~ ., data = sim_tr_cls_cw) %>% step_discretize_cart(
all_predictors(), outcome = "class") %>% prep()
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Code
cart_rec <- recipe(y ~ ., data = sim_tr_reg_cw) %>% step_discretize_cart(
all_predictors(), outcome = "y") %>% prep()
Code
cart_rec
Message
-- Recipe ----------------------------------------------------------------------
-- Inputs
Number of variables by role
outcome: 1
predictor: 2
case_weights: 1
-- Training information
Training data contained 1000 data points and no incomplete rows.
-- Operations
* Discretizing variables using CART: x and z | Trained, weighted
Code
rec_trained <- prep(rec, training = sim_tr_cls, verbose = FALSE)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Code
bake(rec_trained, new_data = sim_tr_cls[, -1])
Condition
Error in `step_discretize_cart()`:
! The following required column is missing from `new_data`: x.
Code
rec
Message
-- Recipe ----------------------------------------------------------------------
-- Inputs
Number of variables by role
outcome: 1
predictor: 10
-- Operations
* Discretizing variables using CART: <none>
Code
rec
Message
-- Recipe ----------------------------------------------------------------------
-- Inputs
Number of variables by role
outcome: 1
predictor: 10
-- Training information
Training data contained 32 data points and no incomplete rows.
-- Operations
* Discretizing variables using CART: <none> | Trained
Code
print(rec)
Message
-- Recipe ----------------------------------------------------------------------
-- Inputs
Number of variables by role
outcome: 1
predictor: 2
-- Operations
* Discretizing variables using CART: all_predictors()
Code
prep(rec)
Condition
Warning:
`step_discretize_cart()` failed to find any meaningful splits for predictor 'z', which will not be binned.
Message
-- Recipe ----------------------------------------------------------------------
-- Inputs
Number of variables by role
outcome: 1
predictor: 2
-- Training information
Training data contained 1000 data points and no incomplete rows.
-- Operations
* Discretizing variables using CART: x | Trained
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.