Performs k-fold cross-validation where groups are chosen randomly. In case the value k is not divisor of the number of observations the last group will have nobs mod k observations.
## S3 method for class 'MultiWaveAnalysis'KFCV(data, labels, method, k =5L, returnClassification =FALSE,...)
Arguments
data: MultiWaveAnalysis (MWA) object obtained with MultiWaveAnalysis and preferably obtained a subset of its characteristics (StepDiscrim,StepDiscrimV)
labels: labeled vector that classify the observations.
method: Selected method for discrimination. Valid options "linear" "quadratic"
k: the number of folds in KFCV. Must be a positive integer and lower or equal than the number of observations
returnClassification: Allows to select if the raw result classification is returned.
...: Additional arguments
Returns
if returnClassification is false return a object of class confusionMatrix
if returnClassification is true, it returns a list containing an object of the confusionMatrix class and a vector with the classification result.
Examples
load(system.file("extdata/ECGExample.rda",package ="TSEAL"))MWA <- MultiWaveAnalysis(ECGExample,"haar", features = c("var"))MWADiscrim <- StepDiscrim(MWA, c(rep(1,5), rep(2,5)),5, features = c("var"))CM <- KFCV(MWADiscrim, c(rep(1,5), rep(2,5)),"linear",5, returnClassification =FALSE)