bsnsing.formula: Learn a Classification Tree using Boolean Sensing

View source: R/bsnsing.R

bsnsing.formulaR Documentation

Learn a Classification Tree using Boolean Sensing

Description

The program builds a binary classification tree for each unique value in the response variable. Each tree classifies a target value against all the other values (internally coded as 'all.other') in the response variable. If the response variable is a numeric type, the number of unique values must not exceed 30. There is no programmatic restriction on the number of unique levels for a factor response.

Usage

## S3 method for class 'formula'
bsnsing(formula, data, subset, na.action = stats::na.pass, ...)

Arguments

formula

an object of class "formula": a symbolic description of the model to be fitted.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which bsnsing.formula is called.

subset

an optional vector specifying a subset (in terms of index numbers, not actual data) of observations to be used in the fitting process.

na.action

a function which indicates what should happen when the data contain NAs. If na.pass is used, bsnsing will still apply an internal NA treatment logic, as follows: missing values in numeric variables will be replaced by the median of the non-missing values of the variable; missing values in factor variables will be treated as a spearate level named 'NA'.

...

additional arguments to be passed to the low level fitting functions, e.g., elements in the bscontrol object.

Value

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

Examples

# 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

# Two-class classification
bs <- bsnsing(origin ~ mpg + displacement + horsepower + weight, data = auto, verbose = TRUE)
summary(bs)

bsnsing documentation built on July 4, 2022, 1:06 a.m.