kohonen_check.m

来自「this file is leverage algorithm written 」· M 代码 · 共 50 行

M
50
字号
function errortype = kohonen_check(X,settings,model,type)

% multiple checks for kohonen inputs
%
% see the HTML HELP files (help.htm) for details 

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) < 2 | ndims(X) > 2                 
    errortype = 'input error: wrong data structure, data must be a 2 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,2) ~= size(model.net.W,3)                 
    errortype = 'input error: the number of variables (columns) in X are different with respect to the number of layers in the model';
    return
end

⌨️ 快捷键说明

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