⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pred_multiway.m

📁 MOLMAP multiway toolbox是一个matlab集成工具箱
💻 M
字号:
function pred = pred_multiway(X,model)

% prediction of MOLMAP score of unknown samples.
% pred_multiway calculates the MOLMAP scores of unknown samples 
% by using a previuos MOLMAP model built by means of model_multiway
%
% pred = pred_multiway(X,model);
%
% input:
%   X           3way data [n x p x k], n samples, p variables, k variables
%   model       model structure built with model_multiway
% 
% output:
%   pred is a structure, with the following fields
%   pred.top_map         input-vector position in the kohonen map [n*p x 2]
%   pred.label_sample    input-vector labels on the basis
%                        of original multiway samples
%   pred.score           predicted 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

% checks
errortype = multiway_check(X,[],model,'pred');  
if ~strcmp(errortype,'none')
    disp(errortype)
    return
end

% data scaling
[Xsca,scal,label_sample] = multiway_scaling(X,[],model);

% projects the samples on the topmap 
nsize = size(model.net.W,1);
W_reshape = reshape(permute(model.net.W,[2 1 3]),[nsize*nsize size(Xsca,2)]);
for i = 1:size(Xsca,1)
    x_in = Xsca(i,:);
    winner = som_winner(x_in,W_reshape);    
    [pos(i,1),pos(i,2)] = som_which_neuron(winner,size(W_reshape,1));
end

% molmap scores
pred_score = multiway_score(Xsca,W_reshape,pos,label_sample,model.net.settings);

% saves results
pred.type = 'multiway';
pred.label_sample = label_sample;
pred.score = pred_score;
pred.top_map = pos;

⌨️ 快捷键说明

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