tidyRules.cubist {tidyrules} | R Documentation |
Obtain rules as a tidy tibble from a cubist model
Description
Each row corresponds to a rule. A rule can be copied into 'dplyr::filter' to filter the observations corresponding to a rule
Usage
## 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:
language (string, default: "r"): language where the rules are parsable. The allowed options is one among: r, python, sql
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
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
[Package tidyrules version 0.1.5 Index]