This commit is contained in:
2017-05-28 17:17:42 +09:00
parent 992a5db5bf
commit 0705953efb
10 changed files with 34 additions and 12 deletions

View File

@@ -13,7 +13,8 @@ J = 0;
% Instructions: Compute the cost of a particular choice of theta
% You should set J to the cost.
hx = X*theta;
J = sum((hx - y).^2)/(2*m);

View File

@@ -14,7 +14,8 @@ J = 0;
% You should set J to the cost.
hx = X*theta;
J = sum((hx - y).^2)/(2*m);
% =========================================================================

View File

@@ -105,7 +105,7 @@ fprintf('\n');
% Recall that the first column of X is all-ones. Thus, it does
% not need to be normalized.
price = 0; % You should change this
price = [1, 1650, 3]*theta;
% ============================================================
@@ -150,7 +150,7 @@ fprintf('\n');
% Estimate the price of a 1650 sq-ft, 3 br house
% ====================== YOUR CODE HERE ======================
price = 0; % You should change this
price = [1, 1650, 3]*theta;
% ============================================================

View File

@@ -26,9 +26,10 @@ sigma = zeros(1, size(X, 2));
% Hint: You might find the 'mean' and 'std' functions useful.
%
mu = mean(X);
X_norm .-= mu;
sigma = std(X);
X_norm ./= sigma;

View File

@@ -18,7 +18,8 @@ for iter = 1:num_iters
%
hx = X*theta;
theta -= (alpha*sum((hx-y).*X)/m)';

View File

@@ -20,7 +20,8 @@ for iter = 1:num_iters
hx = X*theta;
theta -= (alpha*sum((hx-y).*X)/m)';

View File

@@ -12,7 +12,7 @@ theta = zeros(size(X, 2), 1);
% ---------------------- Sample Solution ----------------------
theta = pinv(X'*X)*X'*y;
% -------------------------------------------------------------

View File

@@ -17,7 +17,9 @@ figure; % open a new figure window
% markers larger by using plot(..., 'rx', 'MarkerSize', 10);
plot(x, y, 'rx', 'MarkerSize', 10);
ylabel('Profit in $10,000s');
xlabel('Population of City in 10,000s');
% ============================================================

15
ex1/token.mat Normal file
View File

@@ -0,0 +1,15 @@
# Created by Octave 4.2.1, Sun May 28 17:11:16 2017 GMT <unknown@unknown>
# name: email
# type: sq_string
# elements: 1
# length: 16
mjjo53@gmail.com
# name: token
# type: sq_string
# elements: 1
# length: 16
9Dxrb898sAaadc8j

View File

@@ -11,7 +11,7 @@ A = [];
A = eye(5);