Predicts multiple rule_nbr
(s) applicable for a row_nbr
(per
key) in new_data
# S3 method for ruleset
predict(object, new_data, ...)
A ruleset
(dataframe)
unused
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.
model_c5 = C50::C5.0(species ~.,
data = palmerpenguins::penguins,
trials = 5,
rules = TRUE
)
tidy_c5_ruleset = as_ruleset(tidy(model_c5))
tidy_c5_ruleset
#> ---- Ruleset -------------------------------
#> ▶ Keys: trial_nbr
#> ▶ Number of distinct keys: 5
#> ▶ Number of rules: 26
#> ▶ Model type: C5
#> ▶ Estimation type: classification
#> ▶ Is validation data set: FALSE
#>
#>
#> rule_nbr trial_nbr LHS RHS support confidence lift
#> <int> <int> <chr> <fct> <int> <dbl> <dbl>
#> 1 1 1 ( island == 'Biscoe' ) & (… Gent… 122 0.992 2.8
#> 2 2 1 ( bill_length_mm <= 43.3 )… Adel… 68 0.986 2.2
#> 3 3 1 ( island == 'Dream' ) & ( … Chin… 48 0.98 5
#> 4 4 1 ( bill_length_mm > 42.3 ) … Chin… 34 0.944 4.8
#> 5 5 1 ( flipper_length_mm <= 206… Adel… 213 0.698 1.6
#> 6 1 2 ( bill_length_mm <= 40.8 ) Adel… 86 0.989 3
#> 7 2 2 ( island == 'Torgersen' ) Adel… 39 0.976 2.9
#> 8 3 2 ( island == 'Biscoe' ) & (… Adel… 32 0.971 2.9
#> 9 4 2 ( island == 'Dream' ) & ( … Chin… 87 0.910 3.9
#> 10 5 2 ( island == 'Biscoe' ) Gent… 183 0.816 1.9
#> # ℹ 16 more rows
#> --------------------------------------------
predict(tidy_c5_ruleset, palmerpenguins::penguins)