SWAP.KTSP.CV: Performs k-fold cross validation.

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/exportedFuncs.R

Description

Partitions the data into k folds and applies SWAP.GetKTSP.TrainTestResults for each fold. Then it combines prediction votes by dividing the vote sums by the number of TSPs in each fold to produce an overall cross-validation result.

Usage

1
2
SWAP.KTSP.CV(inputMat, Groups, classes = NULL, k = 4, 
  folds = NULL, randomize = TRUE, ...)

Arguments

inputMat

is a matrix of data with rows being the features (such as gene names, if the matrix if gene expression data) and columns being the samples.

Groups

is a factor or a vector providing the phenotype class each sample belongs to. It should correspond to the order of samples given by the columns of inputMat.

classes

is a vetor of length 2 providing the two phenotype or class labels.

k

an integer giving the number of folds to use.

folds

a list containing the samples to be used in each fold; if NULL, the data will be split into k folds maintaning the proportions between the classes.

randomize

is a logical indicating whether to randomize the sample order before diving into k folds.

...

any further arguments to be passed on for k-TSP training.

Value

A list with items:

folds

A list containing the sample indices used in each fold.

cv

A list containing the classifier, training performance and testing performance for each fold.

stats

Overall cross-validation performance.

roc

ROC curve object for overall cross-validation performance.

Author(s)

Bahman Afsari bahman.afsari@gmail.com, Luigi Marchionni marchion@jhu.edu, Wikum Dinalankara wdinala1@jhmi.edu

References

See switchBox for the references.

See Also

SWAP.KTSP.LOO

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
### Load gene expression data
data(trainingData)
data(testingData)

require(pROC)

### perform leave one out cross-validation
result = SWAP.KTSP.CV(matTraining, trainingGroup, featureNo=100)

### print results
result$stats

switchBox documentation built on Nov. 8, 2020, 5:43 p.m.