K-fold Cross Validation Performance
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ahmad
el 3 de Dic. de 2014
Respondida: Greg Heath
el 12 de Dic. de 2014
Hello All, I am a newbie in Validating models, I am currently trying to make use of the MATLAB K-fold validation to assess the performance of my polynomial model that predicts house prices. I have 243 samples, i divided them into 10 groups, i then used 'for loop' to test 9 groups against 1 group (repeated X 10) My problem is storing the error rate (performance) for the 10 times i am making the prediction. How do i do that please? I tried making use of 'classperf' but i am getting the following error, Please see my code below;
Data set sample:
DateX: 10,20,30,40 ... PriceY: 200,250,300,400 ...
--------Code (MATLAB)-------
K = 10;
cvFolds = crossvalind('Kfold',DateX,K); %10-folds
cp = classperf(DateX); %To store (performance)
for i = 1:K
testIDx = (cvFolds == i);
trainIDx = ~testIDx;
model1 = polyfit(DateX(trainIDx),PriceY(trainIDx),2);
prediction1=model1(1)*DateX(testIDx).^2+model1(2)*DateX(testIDx)+model1(3);
cp = classperf(cp,prediction1,testIDx);
end
My Error Message;
Error using classperf (line 230) When the class labels of the CP object are numeric, the output of the classifier must be all non-negative integers or NaN's.
Is there any suggestions please on how i can store the performance of my model AND i would apperciate examples of other methods In MATLAB that i can apply to make predictions and validate performance (Neural networks, Classification e.t.c.)?? THANK YOU!
0 comentarios
Respuesta aceptada
Greg Heath
el 12 de Dic. de 2014
I do not have the functions crossvalind and classperf.
Although I do have crossval and cvpartition, I favor my own code used in the following NEWSGROUP posts:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/326830#898048
http://www.mathworks.com/matlabcentral/newsreader/view_thread/331830#911882
Hope this helps.
Thank you for formally accepting my answer
Greg
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Gaussian Process Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!