Should I use cvpartition before using crossval function?
Mostra commenti meno recenti
Hi friends,
I am trying to use k-fold cross validation in Matlab. I analyze the examples and Matlab documents about it but I am confused at one point. Can you tell me which usage is correct ?
Usage 1:
Model=fitcknn(feat,label,'NumNeighbors',k,'Distance','euclidean');
%feat is x data of all data set label is y data of all data set.
C=crossval(Model,'KFold',kfold);
ER=kfoldLoss(C);
Usage 2:
SVMModel = fitcecoc(trainingData,classes);
cp = cvpartition(classes, 'k', 10);
CVM = crossval(SVMModel, 'CVPartition', cp);
ER=kfoldLoss(CVM)
Also, does the usage of this line of code change according to the classifier used in the code? For example, if I use fitcsvm instead of fitcknn, should I remove any function? (I think, I should not.)
1 Commento
Umit Kilic
il 18 Gen 2021
Risposte (0)
Categorie
Scopri di più su Gaussian Process Regression in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!