Cursera: Machine Learning Exercises 1 Accomplished.

This commit is contained in:
2015-02-15 10:59:36 +04:00
parent 0f638a71f4
commit 8bd0771809
16 changed files with 1409 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
function [theta] = normalEqn(X, y)
%NORMALEQN Computes the closed-form solution to linear regression
% NORMALEQN(X,y) computes the closed-form solution to linear
% regression using the normal equations.
theta = zeros(size(X, 2), 1);
% ====================== YOUR CODE HERE ======================
% Instructions: Complete the code to compute the closed form solution
% to linear regression and put the result in theta.
%
% ---------------------- Sample Solution ----------------------
theta = pinv(X'*X)*X'*y;
% -------------------------------------------------------------
% ============================================================
end