predict.ruleset {tidyrules}R Documentation

predict method for a ruleset

Description

Predicts multiple rule_nbr(s) applicable for a row_nbr (per key) in new_data

Usage

## S3 method for class 'ruleset'
predict(object, new_data, ...)

Arguments

object

A ruleset

new_data

(dataframe)

...

unused

Value

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.

See Also

predict.rulelist

Examples

model_c5 = C50::C5.0(species ~.,
                     data = palmerpenguins::penguins,
                     trials = 5,
                     rules = TRUE
                     )
tidy_c5_ruleset = as_ruleset(tidy(model_c5))
tidy_c5_ruleset

predict(tidy_c5_ruleset, palmerpenguins::penguins)


[Package tidyrules version 0.2.7 Index]