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에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!