SVM.nfoldcv: Cross validation for SVM

Description Usage Arguments Value Examples

View source: R/SVM.nfoldcv.R

Description

This function performs cross validation to find best combinatiuon of hyper perameters and cost and uses this model to provide prediction performace results.

Usage

1
2
SVM.nfoldcv(data, outcome, train.samples, C, kernels, degree, scale, sigma,
  nfold = 10)

Arguments

data

List of data matrices for each pathways for each pathway

outcome

Binary outcome variable for MKL

train.samples

Vector of indices that will be used as training samples

C

Vector of canduidate cost parameters

kernels

vector of kernel types

degree

Degree of polynomial kernel matrix

scale

Leading coefficient on the polynomial kernel

sigma

Hyperparameter for the radial basis kernel

nfold

Number of folds used in cross validation

Value

cm Confustion matrix along with a variety of accuracy statistics

best.model Model that had the highest accuracy with nfold cross validation

Examples

1
2
3
4
5
6
7
data(benchmark.data)
example.data=benchmark.data[[1]]
training.samples=sample(1:nrow(example.data), floor(0.7*nrow(example.data)),replace=FALSE)
C=2^c(-1,1)
#Find the best cost parameter within the provided range if a linear kernel is used
SVM.nfoldcv(example.data[,1:2], as.factor(example.data[,3]),training.samples,C,
            'linear',0,0,0,nfold=3)

RMKL documentation built on May 2, 2019, 7:55 a.m.