set_validation_data {tidyrules} | R Documentation |
Add validation_data
to a rulelist
Description
Returns a rulelist with three new attributes set:
validation_data
, y_name
and weight
. Methods such as
augment, calculate,
prune, reorder require this to be set.
Usage
set_validation_data(x, validation_data, y_name, weight = 1)
Arguments
x |
A rulelist |
validation_data |
(dataframe) Data to used for computing some metrics.
It is expected to contain |
y_name |
(string) Name of the dependent variable column. |
weight |
(non-negative numeric vector, default: 1) Weight per
observation/row of |
Value
A rulelist with some extra attributes set.
See Also
rulelist, tidy, augment, predict, calculate, prune, reorder
Other Core Rulelist Utility:
set_keys()
Examples
att = modeldata::attrition
set.seed(100)
index = sample(c(TRUE, FALSE), nrow(att), replace = TRUE)
model_c5 = C50::C5.0(Attrition ~., data = att[index, ], rules = TRUE)
tidy_c5 = tidy(model_c5)
tidy_c5
tidy_c5_2 = set_validation_data(tidy_c5,
validation_data = att[!index, ],
y_name = "Attrition",
weight = 1 # default
)
tidy_c5_2
tidy_c5 # not altered
[Package tidyrules version 0.2.7 Index]