rules_filter {creditmodel}R Documentation

rules_filter

Description

rules_filter This function is used to filter or select samples by rules.

Usage

rules_filter(dat, rules_list, drop = FALSE, logic = "or")

Arguments

dat

A data.frame.

rules_list

A list of rules.

drop

Logical, if TRUE, dropping samples, if FALSE, selecting samples. Default is FALSE.

logic

The logic between rules in the rules_list: 'and','or'. Default is 'or'.

Value

A data frame.

See Also

get_ctree_rules, check_rules

Examples

train_test = train_test_split(UCICreditCard, split_type = "Random", prop = 0.8, save_data = FALSE)
dat_train = train_test$train
dat_test = train_test$test
dat_train$default.payment.next.month = as.numeric(dat_train$default.payment.next.month)
rules_list = get_ctree_rules(tree_fit = NULL, train_dat = dat_train[, 8:26],
                             target ="default.payment.next.month", test_dat = dat_test)[1:3,2]
 new_dat = rules_filter(rules_list = rules_list[3], dat = dat_test)


[Package creditmodel version 1.3.0 Index]