cpann_update.m

来自「Kohonen and CPANN toolbox是开发的一个MATLAB工具箱」· M 代码 · 共 42 行

M
42
字号
function Wnew = cpann_update(x,W,winner,settings,act_epoch,act_obj,tot_obj,param_correction)

% cpann_update updates CPANN weights
%
% see the HTML HELP files (help.htm) for details 
% or type "help model_kohonen" or "help model_cpann"
%
% Wnew = cpann_update(x,W,winner,settings,act_epoch,act_obj,tot_obj,param_correction);
%
% input:
%   x           sample [1 x c]
%   W           unfolded CPANN weights [size*size x c]
%   winner      winner neuron
%   settings    setting structure
%   act_epoch   number of actual epoch
%   act_obj     numbe rof actual sample
%   tot_obj     total number of samples
%   param_correction   structure for neuron correction
%
% output:
%   Wnew       unfolded updated CPANN weights [size*size x c]
%
% see the HTML HELP files (help.htm) for details 

L = param_correction.L;
rings = param_correction.rings;

% applies updating in the winning neuron
Wnew = W;
Wnew(winner,:) = W(winner,:) + L*1*(x - W(winner,:));

% applies updating in the rings
for r=1:rings
    D = 1 - r/(1 + rings);
    ind = param_correction.list_of_neurons{r}';
    x_diff = zeros(size(ind,1),size(x,2));
    for j=1:size(x,2)
        x_diff(:,j) = x(j);
    end
    Wnew(ind,:) = W(ind,:) + L*D*(x_diff - W(ind,:));
end

⌨️ 快捷键说明

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