Skip to content

Utilities to Retrieve Rulelists from Model Fits, Filter, Prune, Reorder and Predict on unseen data

Notifications You must be signed in to change notification settings

talegari/tidyrules

Repository files navigation

tidyrules

CRAN_Status_Badge

tidyrules R package provides a framework to work with decision rules. Rules can be extracted from supported models, augmented with (custom) metrics using validation data, manipulated using standard dataframe operations, reordered and pruned based on a metric, predict on unseen (test) data. Utilities include; Creating a rulelist manually, Exporting a rulelist as a SQL case statement and so on. The package offers two classes; rulelist and ruleset based on dataframe.

website: https://talegari.github.io/tidyrules/

Example

expand/collapse
library(tidyrules)
model_c5 = C50::C5.0(Species ~ ., data = iris, rules = TRUE)
tidy(model_c5)
#> ---- Rulelist --------------------------------
#> ▶ Keys: trial_nbr
#> ▶ Number of distinct keys: 1
#> ▶ Number of rules: 4
#> ▶ 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 ( Petal.Length <= 1.9 )      seto…      50      0.981   2.9
#> 2        2         1 ( Petal.Length > 1.9 ) & ( … vers…      48      0.96    2.9
#> 3        3         1 ( Petal.Width > 1.7 )        virg…      46      0.958   2.9
#> 4        4         1 ( Petal.Length > 4.9 )       virg…      46      0.938   2.8
#> ----------------------------------------------

Installation

expand/collapse

You can install the released version of tidyrules from CRAN with:

install.packages("tidyrules")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("talegari/tidyrules")

About

Utilities to Retrieve Rulelists from Model Fits, Filter, Prune, Reorder and Predict on unseen data

Topics

Resources

Stars

Watchers

Forks

Languages