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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Greg Heath
2016-5-8
My only suggestion is to search both the NEWSGROUP and ANSWERS using the search word 'crossval'
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gaussian Process Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!