Learn R Programming

mt (version 2.0-1.20)

binest: Binary Classification

Description

Binary classification.

Usage

binest(dat, cl, choices = NULL, method, pars=valipars(),...)

Value

A list with components:

com

A matrix of combination of the binary class labels.

acc

A table of classification accuracy for the binary combination in each iteration.

method

Classification method used.

sampling

Sampling scheme used.

niter

Number of iterations.

nreps

Number of replications in each iteration if resampling is not loocv.

Arguments

dat

A matrix or data frame containing the explanatory variables.

cl

A factor specifying the class for each observation.

choices

The vector or list of class labels to be chosen for binary classification. For details, see dat.sel.

method

Classification method to be used. For details, see accest.

pars

A list of parameters of the resampling method. For details, see valipars.

...

Additional parameters to method.

Author

Wanchang Lin

See Also

accest, valipars, dat.sel

Examples

Run this code
# iris data set
data(iris)
dat <- subset(iris, select = -Species)
cl  <- iris$Species

## PCALDA with cross-validation
pars    <- valipars(sampling="cv",niter = 6, nreps = 5)
binpcalda <- binest(dat,cl,choices=c("setosa"), method="pcalda", pars = pars)

## SVM with leave-one-out cross-validation. SVM kernel is 'linear'.
pars   <- valipars(sampling="loocv")
binsvm <- binest(dat,cl,choices=c("setosa","virginica"), method="svm",
                 pars = pars, kernel="linear")

## randomForest with bootstrap
pars  <- valipars(sampling="boot",niter = 5, nreps = 5)
binrf <- binest(dat,cl,choices=c("setosa","virginica"), 
                method="randomForest", pars = pars)

## KNN with randomised validation. The number of neighbours is 3.
pars   <- valipars(sampling="rand",niter = 5, nreps = 5)
binknn <- binest(dat,cl,choices = list(c("setosa","virginica"),
                                       c("virginica","versicolor")), 
                 method="knn",pars = pars, k = 3)

Run the code above in your browser using DataLab