的幫助亞瑟B.我終於明白了這個概念。 這是我的實現。儘管我使用了Plus l帶走r算法(Sequential Forwardwards Backward Search)的病態帖子,因爲一旦反向搜索被刪除,它基本上是相同的。下面的實現是在MATLAB中,但很容易理解:
S=zeros(Size,1); %Initial the binary array feature list with all zeros implying no feature selected
k=0;
while k<n %Begin SFS. n is the number of features that need to be extracted
t=k+l; %l is the number of features to be added in each iteration
while k<t
R=zeros(Size,1); %Size is the total number of features
for i=1:Size
if S(i)==0 %If the feature has not been selected. S is a binary array which puts a one against each feature that is selected
S_copy=S;
S_copy(i)=1;
R=OperateBhattacharrya(Matrices,S_copy,i,e,R); %The result of each iteration is stored in R
end
end
k=k+1; %increment k
[~,N]=max(R); %take the index of the maximum element in R as the best feature to be selected
S(N)=1; % put the index of selected feature as 1
end
t=k-r; %r is the number of features to be removed after selecting l features. l>r
while k>t %start Sequential Backward Search
R=zeros(Size,1);
for i=1:Size
if S(i)==1
S_copy=S;
S_copy(i)=0;
R=OperateBhattacharrya(Matrices,S_copy,i,1,R);
end
end
k=k-1;
[~,N]=max(R);
S(N)=0;
end
fprintf('Iteration :%d--%d\n',k,t);
end
我希望這可以幫助任何人有類似的問題。
是否有'OperateBhattacharrya'函數的任何代碼? – Matthieu
@Matthieu會有。這是一個接近兩年前的研究項目。 – Sohaib