tidyRules.cubist: Obtain rules as a tidy tibble from a cubist model

Description Usage Arguments Details Value Author(s) Examples

View source: R/cubist.R

Description

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

Usage

1
2
## S3 method for class 'cubist'
tidyRules(object, ...)

Arguments

object

Fitted model object with rules

...

Other arguments (currently unused)

Details

When col_classes argument is missing, an educated guess is made about class by parsing the RHS of sub-rule. This might sometimes not lead to a parsable rule.

Optional named arguments:

Value

A tibble where each row corresponds to a rule. The columns are: support, mean, min, max, error, lhs, rhs and committee

Author(s)

Srikanth KS, sri.teach@gmail.com

Examples

1
2
3
4
5
6
7
8
data("attrition", package = "modeldata")
attrition <- tibble::as_tibble(attrition)
cols_att <- setdiff(colnames(attrition), c("MonthlyIncome", "Attrition"))

cb_att <-
  Cubist::cubist(x = attrition[, cols_att],y = attrition[["MonthlyIncome"]])
tr_att <- tidyRules(cb_att)
tr_att

tidyrules documentation built on July 1, 2020, 5:49 p.m.