multiway_score.m

来自「MOLMAP multiway toolbox是一个matlab集成工具箱」· M 代码 · 共 46 行

M
46
字号
function score = multiway_score(X,W,pos,label_sample,settings)

% molmap_score calculates the MOLMAP score on the Kohonen net
% score is the MOLMAP score matrix (n x size*size), where
% size is the Kohonen map dimension defined in the settings.
%
% see the HTML HELP files (help.htm) for extensive explanations, details and examples
%
% The toolbox is freeware and may be used (but not modified) 
% if proper reference is given to the authors. Preferably refer to:
% D. Ballabio, V. Consonni, R. Todeschini
% Classification of multiway analytical data based on MOLMAP approach
% Analytica Chimica Acta, in press
% 
% version 1.0 - november 2007
% Davide Ballabio
% Milano Chemometrics and QSAR Research Group
% www.disat.unimib.it/chm


nsize = settings.nsize;
bound = settings.bound;
net_weight = 1;
win_weight = 1;
neighb_weight = [0.3];
r = length(neighb_weight);

disp('calculating MOLMAP scores...')
for n = 1:max(label_sample)
    sample_in = pos(find(label_sample==n),:);
    S = zeros(nsize,nsize);
    for k = 1:size(sample_in,1)
        prop_in = sample_in(k,:);
        % update winner
        S(prop_in(1),prop_in(2)) = S(prop_in(1),prop_in(2)) + win_weight*net_weight;
        % update neighbours
        ind = som_which_col(prop_in(1),prop_in(2),size(S,1)*size(S,2));
        [list_of_neurons] = som_find_neigb(ind,r,bound,nsize);
        for i = 1:length(list_of_neurons)
            [cord_row,cord_col] = som_which_neuron(list_of_neurons(i),size(S,1)*size(S,2));
            S(cord_row,cord_col) = S(cord_row,cord_col) + neighb_weight;
        end
    end
    score(n,:) = reshape(permute(S,[2 1]),[nsize*nsize 1])';
end

⌨️ 快捷键说明

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