Different ways to implement cross-validation for the SVM model in MATLAB

Suppose we have this code in MATLAB R2015b:

SVMModel = fitcsvm(INPUT, output,'KernelFunction','RBF','BoxConstraint',1);
CVSVMModel = crossval(SVMModel);
z = kfoldLoss(CVSVMModel)
  • The first line uses the model fitcsvmprepared by the hole data. what is the purpose of installing Crossvalin onin fitcsvm(by default we have 10x cross-validation with this option)? Crossvaland kfoldLossusing the same method as above? If so, why is the MATLAB documentation only mentioning this method, which does not establish a method Crossvalfor cross-validation? If this procedure is the same, how can we get the error rate using the first procedure?

  • If we need a prediction function (this is a prediction model), do we need a usage model that was prepared with hole data (here is this an object SVMModel)? Thus, Crossvaland they kfoldLossare used only for calculating the error, we do not have 10 prepared models of this verification method for forecasting. It's true? Does it use integer data for neural network models?

+4
source share
1 answer

Regarding the first question. Both settings "CrossVal"- "on"and the selection of the trained model for the function is crossval()aimed at the same thing. You can use one or the other, it is up to you.

kFoldLoss() per-se, "CrossVal". . , , "CrossVal" fitcsvm() crossval(). - .

, - . Vector Machine Machine, fitcsvm(). ​​ , ( 10- ), . predict(). , ( ) . SVM, . predict() - , , , .

"CrossVal", , :

  • , fitcsvm()
  • , crossval(), kFoldLoss()
  • , predict() # 1    
+3

Source: https://habr.com/ru/post/1628663/


All Articles