bsnsing {bsnsing}R Documentation

Learn a Classification Tree using Boolean Sensing

Description

Depending on the arguments provided, either bsnsing.default or bsnsing.formula will be called.

Usage

bsnsing(x, ...)

Arguments

x

a data frame or a formula object.

...

arguments passed on to bsnsing.default or bsnsing.formula.

Value

an object of class bsnsing for a two-class problem or an object of class mbsnsing for a multi-class problem.

Examples

# Use the formula format
bs <- bsnsing(Class~., data = BreastCancer)
summary(bs)
# For multi-class classification
bs <- bsnsing(Species ~ ., data = iris)
summary(bs)
summary(bs[[1]])  # display the tree for the first class
summary(bs[[2]])  # display the tree for the second class
summary(bs[[3]])  # display the tree for the third class
predict(bs, type = 'class')  # the fitted class membership
predict(bs, type = 'prob')  # the fitted probabilities

# Use the (x, y) format, y must have two levels
y <- ifelse(iris$Species == 'setosa', 1L, 0L)
x <- iris[, c('Sepal.Length', 'Sepal.Width', 'Petal.Length', 'Petal.Width')]
bs <- bsnsing(x, y, verbose = TRUE)
summary(bs)


[Package bsnsing version 1.0.1 Index]