Calculate SVM hyperparameters based on grid search

Share:

Description

Find the cost/gamma parameters based on a grid search by best AUC and by limiting the number of support vectors. Currently only supports discreet binary data.

Usage

1
2
3
recalculateSVMparams(cost.range, gamma.range, d,
    class.weight=1/table(convertToFactor(d$class)), kernel="radial",
    max.prop.SV=0.9)

Arguments

cost.range

the range of cost parameter values to evaluate

gamma.range

the range of gamma parameter values to evaluate

d

the data.frame with variables as columns, the class labels must be labelled with "class"

class.weight

the class weights to use (if there is an large bias for positive/negative class)

kernel

kernel type to use (takes valid package e1071 names like "radial")

max.prop.SV

the maximal proportion of support vectors to number of data points (rows in d)

Value

a list with the two parameters that give best AUC in LOOCV

Examples

1
2
3
4
5
6
## Not run: 
data(mesoBin)
# get SVM AUC etc over cost rage of 1, 100, and gamma range of 0.1, 1
recalculateSVMparams(c(1, 100), c(0.1, 1), convertToFactor(rawData(mesoBin$Meso)))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.