# Training accuracy

I am learning how to use classification in Matlab and have a question on calculating the training and testing accuracy. I am testing my data on SVM algorithm. I am using crossval and found two ways of calculating the training accuracy.

Method 1 After creating a partitioned model using crossval function using the formula (1 - kfoldLoss(partitionedModel, 'LossFun', 'ClassifError') to calculate the accuracy.

Method 2 Using the trained classifier after crossval to predict the responses for the predictors that I used for training. trainedClassifier.predictFcn(TrainingPredictors) and then using the classperf function to compare the predicted values to my actual responses and then calculating the CorrectRate from the classperf function.

In both cases, I am using same predictors and responses, but getting different accuracy numbers.

My questions:

1. Why do I get different accuracy from these two methods?
2. Which one is a correct representation of the training accuracy?
3. Are there better ways to calculate the training accuracy?