i am trying to use cross validation in order to determine the optimum number of hidden units for neural network. Am getting an error which i am not able to decipher.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Error using crossval>evalFun (line 480) The function '@(Xtrain,Ytrain,Xtest)model_finder(i,Xtrain,Ytrain,Xtest)' generated the following error: Invalid types for comparison.
Error in crossval>getLossVal (line 517) funResult = evalFun(funorStr,arg(1:end-1));
Error in crossval (line 416) [funResult,outarg] = getLossVal(i, nData, cvp, data, predfun);
Error in nnrealmain (line 7) mcr=crossval('mcr',x,y,'predfun',hid_find,'partition',c);
This is the main code i typed for cross validation.
load('permanentpcadata.mat');
mcrs=[]; y=[ones(18,1);2*ones(13,1);3*ones(18,1);4*ones(16,1);5*ones(21,1);6*ones(9,1)];
for i=6:20
hid_find=@(Xtrain,Ytrain,Xtest)model_finder(hiiden_units,Xtrain,Ytrain,Xtest); c=cvpartition(y,'k',10); mcr=crossval('mcr',x,y,'predfun',hid_find,'partition',c);
mcrs=[mcrs mcr]; end
save('crossvalop.mat','mcrs');
index=6:20; plot(index,mcrs);
could you suggest where i have gone wrong in the implementation of cross validation?
1 Commento
Greg Heath
il 8 Mag 2016
My only suggestion is to search both the NEWSGROUP and ANSWERS using the search word 'crossval'
Risposte (0)
Vedere anche
Categorie
Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!