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

📄 som_scaling.m

📁 this file is leverage algorithm written in matlab as m-file and tested in matlab.so anyone can ue th
💻 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
%
% optional input, only for CPANNs:
%   model       model structure
% 
% output:
%   X           scaled data [n x p]
%   scal        scaling informations as structure
%
% see the HTML HELP files (help.htm) for details 

% 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 + -