Each row corresponds to a rule. A rule can be copied into `dplyr::filter` to filter the observations corresponding to a rule

# S3 method for rpart
tidyRules(object, ...)

Arguments

object

Fitted model object with rules

...

Other arguments (currently unused)

Value

A tibble where each row corresponds to a rule. The columns are: support, confidence, lift, LHS, RHS

Details

NOTE: For rpart rules, one should build the model without ordered factor variable. We recommend you to convert ordered factor to factor or integer class.

Optional named arguments:

  • language (string, default: "r"): language where the rules are parsable. The allowed options is one among: r, python, sql

Examples

iris_rpart <- rpart::rpart(Species ~ .,data = iris) tidyRules(iris_rpart)
#> # A tibble: 3 x 6 #> id LHS RHS support confidence lift #> <int> <chr> <chr> <int> <dbl> <dbl> #> 1 1 Petal.Length < 2.45 setosa 50 0.981 2.94 #> 2 2 Petal.Length >= 2.45 & Petal.Width <… versicol… 54 0.893 2.68 #> 3 3 Petal.Length >= 2.45 & Petal.Width >… virginica 46 0.958 2.88