multiway_check.m

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

M
63
字号
function errortype = multiway_check(X,settings,model,type)

% multiple checks for MOLMAP inputs
%
% see the HTML HELP files (help.htm) for details 
%
% 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


errortype = 'none';
switch type
    
    case {'model'}
        errortype = check_data(X,errortype);
        errortype = check_settings(settings,errortype);
        
    case {'pred'}
        errortype = check_layer(X,model,errortype);

end

% -------------------------------------------------------------------------


function errortype = check_data(X,errortype)

% data structure
if  ndims(X) < 3 | ndims(X) > 3                 
    errortype = 'input error: wrong data structure, data must be a 3 way data matrix';
    return
end

% -------------------------------------------------------------------------

function errortype = check_settings(settings,errortype)

if  isnan(settings.nsize)                 
    errortype = 'input error: the map size (settings.nsize) is not defined in the setting structure';
    return
end

if  isnan(settings.epochs)                 
    errortype = 'input error: the number of epochs (settings.epochs) is not defined in the setting structure';
    return
end

% -------------------------------------------------------------------------

function errortype = check_layer(X,model,errortype)

if  size(X,3) ~= size(model.net.W,3)                 
    errortype = 'input error: the number of variables in the last mode of X is different with respect to the number of layers in the model';
    return
end

⌨️ 快捷键说明

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