필터 지우기
필터 지우기

Implementing sequentialfs

조회 수: 2 (최근 30일)
C N N
C N N 2012년 2월 16일
I am trying to implement sequentialfs for feature selection. I saw this post : Sequential feature selection Matlab
Tried to follow the example given as the solution to implement.
My TrainVec is a matrix of dimension 268 x1475 whereas TestVec is 116x1475 and TestLabel is 116 x 1 and TestLabel is 268 x 1.
the code i implemented is
f = @(TrainVec,TrainLabel,TestVec,TestLabel) sum(TestLabel ~= predict_label); fs = sequentialfs(f,Vec,Label);
The error i get is :
??? Error using ==> crossval>evalFun at 505 The function '@(TrainVec,TrainLabel,TestVec,TestLabel)sum(TestLabel~=predict_label)' generated the following error: Matrix dimensions must agree. Error in ==> crossval>getFuncVal at 524 funResult = evalFun(funorStr,arg(:)); Error in ==> crossval at 363 funResult = getFuncVal(1, nData, cvp, data, funorStr, []); Error in ==> sequentialfs>callfun at 495 funResult = crossval(fun,x,other_data{:},...
I have checked all my matrixes and ensured that they are of same dimensions. Not sure what is wrong. Need some guidance. Error in ==> sequentialfs at 357 crit(k) = callfun(fun,x,other_data,cv,mcreps);
  댓글 수: 1
Ilya
Ilya 2012년 2월 16일
Your post does not show how you compute predict_label, nor does it say what Vec and Label are. It's hard to say without knowing that, but my guess would be that TestLabel and predict_label passed to f have different lengths.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by