predict.rulelist | R Documentation |
predict
method for a rulelistPredicts rule_nbr
applicable (as per the order in rulelist)
for a row_nbr
(per key) in new_data
## S3 method for class 'rulelist'
predict(object, new_data, multiple = FALSE, ...)
object |
A rulelist |
new_data |
(dataframe) |
multiple |
(flag, default: FALSE) Whether to output all rule numbers applicable for a row. If FALSE, the first satisfying rule is provided. |
... |
unused |
If a row_nbr
is covered more than one rule_nbr
per 'keys', then
rule_nbr
appearing earlier (as in row order of the rulelist) takes
precedence.
When multiple is FALSE
(default), output is a dataframe with three
or more columns: row_number
(int), columns corresponding to 'keys',
rule_nbr
(int).
When multiple is TRUE
, output is a dataframe with three
or more columns: row_number
(int), columns corresponding to 'keys',
rule_nbr
(list column of integers).
If a row number and 'keys' combination is not covered by any rule, then
rule_nbr
column has missing value.
A dataframe. See Details.
rulelist, tidy, augment, predict, calculate, prune, reorder
model_c5 = C50::C5.0(species ~.,
data = palmerpenguins::penguins,
trials = 5,
rules = TRUE
)
tidy_c5 = tidy(model_c5)
tidy_c5
output_1 = predict(tidy_c5, palmerpenguins::penguins)
output_1 # different rules per 'keys' (`trial_nbr` here)
output_2 = predict(tidy_c5, palmerpenguins::penguins, multiple = TRUE)
output_2 # `rule_nbr` is a list-column of integer vectors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.