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, ...)
dataframe to be coerced to a rulelist
(character vector, default: NULL) column names which form the key
(string, default: NULL) Name of the model which generated the rules
(string) One among: 'regression', 'classification'
currently unused
rulelist object
Input dataframe should contain these columns: rule_nbr
, LHS
,
RHS
. Providing other inputs helps augment better.
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
#> ----------------------------------------------