Quantcast
Channel: Question and Answer » svm
Viewing all articles
Browse latest Browse all 48

The whole procedure of training (using LOO-CV) and testing SVM classifier

$
0
0

I have two separated data for training and testing.
I would like to make a SVM model using Leave-One-Out (LOO) cross-validation(CV).
The procedure I follow is like the below pseudo code:

n.tr <- number of samples in trainData.
for(i in 1:n.tr)
{
svm.model <- train(trainData[-i,], trainL[-i])
pred[i] <- predict(svm.model, trainData[i,])
}

# LOO accuarcy
accuracy <- sum(pred==trainL)/n.tr

# Making SVM model using all samples
svm.model <- train(trainData, trainL)

# Testing the SVM model using testData
te.pred <- predict(svm.model, testData)

Is the procedure correct?


Viewing all articles
Browse latest Browse all 48

Trending Articles