Learn R Programming

SVMMaj (version 0.2-2)

svmmajcrossval: k-fold Cross-Validation of SVM-Maj

Description

This function performs a gridsearch of k-fold crossvalidations using SVM-Maj and returns the combination of input values which has the best forecasting performance.

Usage

svmmajcrossval(X,y,search.grid=list(lambda=2^seq(5,-5,length.out=19)),...,convergence=1e-4, 
                  weights.obs=1, check.positive = TRUE, print.progress=FALSE, ngroup = 5, groups = NULL)

Arguments

X

A data frame (or object coercible by as.data.frame to a data frame) consisting the attribues.

y

A factor (or object coercible by factor to a factor) consisting the class labels.

search.grid

A list with for each factor the range of values to search for.

...

Other arguments to be passed through svmmaj.

convergence

Specifies the convergence criterion for svmmaj. Default is 1e-08.

weights.obs

Weigths for the classes.

check.positive

Specifies whether a check should be performed for positive lambda and weights.obs.

print.progress

=TRUE shows the progress of the cross-validation.

ngroup

The number of groups to be divided into.

groups

A predetermined group division for performing the cross validation.

Value

missclass.opt

The minimum (weighted) missclassification rate found in out-of-sample training along the search grid.

param.opt

The level of the factors which gives the minimum loss term value.

param.grid

The matrix of all gridpoints which has been performed during the cross-validation, with its corresponding weighted out-of-sample missclassification rate.

References

P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.

See Also

svmmaj

Examples

Run this code
# NOT RUN {
require(MASS)
Xt <- subset(Pima.tr,select=-type)
yt <- Pima.tr$type

## setting grid range
search.grid= list(lambda=10^seq(1,-1) ,kernel.sigma=2^seq(0,2) )

## performing gridsearch with k-fold crossvalidation
results<-svmmajcrossval(Xt,yt,search.grid = search.grid,
standardize = 'interval',kernel = rbfdot,hinge='quadratic')
results

# }

Run the code above in your browser using DataLab