Convert a set of rules in a dataframe to a rulelist

# S3 method for data.frame
as_rulelist(x, keys = NULL, model_type = NULL, estimation_type, ...)

Arguments

x

dataframe to be coerced to a rulelist

keys

(character vector, default: NULL) column names which form the key

model_type

(string, default: NULL) Name of the model which generated the rules

estimation_type

(string) One among: 'regression', 'classification'

...

currently unused

Value

rulelist object

Details

Input dataframe should contain these columns: rule_nbr, LHS, RHS. Providing other inputs helps augment better.

Examples

rules_df = tidytable::tidytable(rule_nbr = 1:2,
                                LHS      = c("var_1 > 50", "var_2 < 30"),
                                RHS      = c(2, 1)
                                )
as_rulelist(rules_df, estimation_type = "regression")
#> ---- Rulelist --------------------------------
#> ▶ Keys: NULL
#> ▶ Number of rules: 2
#> ▶ Model Type: NULL
#> ▶ Estimation type: regression
#> ▶ Is validation data set: FALSE
#> 
#> 
#>   rule_nbr LHS          RHS
#>      <int> <chr>      <dbl>
#> 1        1 var_1 > 50     2
#> 2        2 var_2 < 30     1
#> ----------------------------------------------