bslearn | R Documentation |
The function solves a mixed integer program (MIP) to maximize the Gini reduction (opt.model = 'gini') or minimize the number of misclassified cases (opt.model = 'error').
bslearn(bx, y, control = bscontrol())
bx |
a data frame with binary (0 and 1) entries. |
y |
an integer vector with binary entries. |
control |
an object of class |
a list containing the splitting solution.
x <- auto[, c('mpg', 'cylinders', 'displacement')] y <- ifelse(auto$origin == 'USA', 1L, 0L) # binarize x by y = 1 bx <- binarize(x, y, target = 1) # learn the optimal Boolean rule bssol <- bslearn(bx, y, bscontrol(opt.solver = 'enum')) cat(paste("Optimal rule:" , bssol$rules, "\n"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.