-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatureNormalize.m
More file actions
executable file
·63 lines (53 loc) · 1.78 KB
/
Copy pathfeatureNormalize.m
File metadata and controls
executable file
·63 lines (53 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function [X_norm] = featureNormalize(X)
%FEATURENORMALIZE Normalizes the features in X
% FEATURENORMALIZE(X) returns a normalized version of X where
% the mean value of each feature is 0 and the standard deviation
% is 1. This is often a good preprocessing step to do when
% working with learning algorithms.
% You need to set these values correctly
%X_norm = X;
%mu = zeros(1, size(X, 2));
%sigma = zeros(1, size(X, 2));
% ====================== YOUR CODE HERE ======================
% Instructions: First, for each feature dimension, compute the mean
% of the feature and subtract it from the dataset,
% storing the mean value in mu. Next, compute the
% standard deviation of each feature and divide
% each feature by it's standard deviation, storing
% the standard deviation in sigma.
%
% Note that X is a matrix where each column is a
% feature and each row is an example. You need
% to perform the normalization separately for
% each feature.
%
% Hint: You might find the 'mean' and 'std' functions useful.
<<<<<<< HEAD
%@author : Sushilkundu
=======
%@author : Sushikundu
>>>>>>> 73ff4ee0e920609cff253fc81320fb2987e6ee39
% mu=mean(X);
% sigma=std(X,1);
% mu_rep=repmat(mu,size(X,1),1);
% sigma_rep=repmat(sigma, size(X,1),1);
% mean_diff=X-mu_rep;
% sigma_div=mean_diff./sigma_rep;
% X_norm=sigma_div;
<<<<<<< HEAD
% a = min (X(:));
b = max (X(:));
% ra = 0.9;
% rb = 0.1;
%
% X_norm = (((ra - rb) * (X - a))/ (b -a)) + rb;
X_norm=X/b;
=======
a = min (X(:));
b = max (X(:));
ra = 0.9;
rb = 0.1;
X_norm = (((ra - rb) * (X - a))/ (b -a)) + rb;
>>>>>>> 73ff4ee0e920609cff253fc81320fb2987e6ee39
% ============================================================
end