updateparticle_lhl.m

来自「将PSO和LBG结合在一步迭代过程中」· M 代码 · 共 32 行

M
32
字号
% =====================================================================
%                 PP algorithm 
%                 sub program for pp
%     Start Date: 15/07/2006
%   Last Changed: 21/08/2006
%  
%  Specification: The algorithm, proposed by Ji and Liao in 2006, incorporating
%                 both PSO algorithm and LBG to one iteration and using  
%                 particle-pair to explore in the problem space
%
% Copyright (c) Ji and Liao in 2006
% All rights Reserved
%==========================================================================

for k=1:num_particle
    mu=reshape(particle(k,:,IndexIteration),D,num_cluster);
    [I,mu,C] = kmeans_lhl(trainingvector',256,mu);
    mu=mu';
    [bigD,geitv]=sort(C);
    time=0;
   for ttt=1:256
       if isnan(mu(ttt,1))==1
           time=time+1;
           temptv=geitv(end-time+1);
           mu(ttt,:)=trainingvector(temptv,:);
       end
   end
   mu=mu';
    particle(k,:,IndexIteration)=reshape(mu,1,D*num_cluster);
end
    
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?