U E D R , A S I H C RSS

MachineLearning스터디/LinearRegressionWithMultipleVariables (rev. 1.3)

Machine Learning스터디/Linear Regression With Multiple Variables


1. Multiple Features

2. Gradient Descent for Multiple Variables

3. Feature Scaling

4. Learning Rate

5. Polynomial Regression

6. Normal Equation

7. Octave로 Linear Regression With Multiple Varables 구현하기

7.1. Feature Normalize

function [X_norm, mu, sigma] = 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));
n_of_feature = size(X_norm, 2);
for i = 1:n_of_feature
	mu(i) = mean(X_norm(:, i));
	sigma(i) = std(X_norm(:, i));
	X_norm(:, i) = (X_norm(:, i ) - mu(i)) / sigma(i);
end

  • mean : 평균 구하는 함수.
  • std : 표준 편차 구하는 함수.
  • 표준 편차를 이용해서 데이터를 정규화 시킴.
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:42
Processing time 0.0217 sec