Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 8/Programming Assignment - 7/ex7/featureNormalize.m
863 views
1
function [X_norm, mu, sigma] = featureNormalize(X)
2
%FEATURENORMALIZE Normalizes the features in X
3
% FEATURENORMALIZE(X) returns a normalized version of X where
4
% the mean value of each feature is 0 and the standard deviation
5
% is 1. This is often a good preprocessing step to do when
6
% working with learning algorithms.
7
8
mu = mean(X);
9
X_norm = bsxfun(@minus, X, mu);
10
11
sigma = std(X_norm);
12
X_norm = bsxfun(@rdivide, X_norm, sigma);
13
14
15
% ============================================================
16
17
end
18
19