-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprefun.m
More file actions
23 lines (20 loc) · 709 Bytes
/
Copy pathprefun.m
File metadata and controls
23 lines (20 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function [pre_X,pre_param]=prefun(X,option)
% Preprocessing function
% apply range-scaling or auto-scaling
% Growing Grid (GG)
% version 1.0 - Dec 2017
% Mahdi Vasighi
% Institute for Advanced Studies in Basic Sciences, Zanjan, Iran
% Department of Computer Science and Information Technology
% www.iasbs.ac.ir/~vasighi/
[n1,~]=size(X);
switch option
case 'rs' % range scaling the columns
pre_X=(X-repmat(min(X),n1,1))./(repmat(max(X)-min(X),n1,1));
pre_param.min=min(X);
pre_param.max=max(X);
case 'as' % mean centering
pre_X=(X-repmat(mean(X),n1,1))./(repmat(std(X),n1,1));
pre_param.cmean=mean(X);
pre_param.cstd=std(X);
end