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

📄 som_scaling.m

📁 MOLMAP multiway toolbox是一个matlab集成工具箱
💻 M
字号:
function [Xsca,scal] = som_scaling(X,settings,model)

% som_scaling applies range scaling inbetween 0 and 1.
% If model (optional) is an input, then data are scaled on the basis
% of the scaling parameters of the model (scaling of test samples)
%
% [Xsca,scal] = som_scaling(X,settings,model)
%
% input:
%   X           data [n x p]
%   settings    setting structure
%   model       model structure
% 
% output:
%   X           scaled data [n x p]
%   scal        scaling informations as structure
%
% 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


% applies range scaling on training samples
if nargin < 3
    for j=1:size(X,2)
        min_var(j) = min(X(:,j));
        max_var(j) = max(X(:,j));
        for i=1:size(X,1)
            Xsca(i,j) = (X(i,j) - min_var(j))/(max_var(j) - min_var(j)); 
        end
    end 
    scal.type = 'range_scaling';
    scal.min_var = min_var;
    scal.max_var = max_var;  
else % applies range scaling on test samples
    for j=1:size(X,2)
        min_var(j) = model.scal.min_var(j);
        max_var(j) = model.scal.max_var(j);
        for i=1:size(X,1)
            Xsca(i,j) = (X(i,j) - min_var(j))/(max_var(j) - min_var(j)); 
        end
    end
    scal = 0;    
end

⌨️ 快捷键说明

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