Finishes Week 6

This commit is contained in:
julien Lengrand-Lambert
2015-12-12 11:15:26 +01:00
parent 78ede21908
commit cfcd8b02b0
4 changed files with 12 additions and 12 deletions

View File

@@ -123,7 +123,7 @@ for i = 1:m
end
fprintf('Program paused. Press enter to continue.\n');
pause;
% pause;
%% =========== Part 6: Feature Mapping for Polynomial Regression =============
% One solution to this is to use polynomial regression. You should now
@@ -153,7 +153,7 @@ fprintf('Normalized Training Example 1:\n');
fprintf(' %f \n', X_poly(1, :));
fprintf('\nProgram paused. Press enter to continue.\n');
pause;
% pause;

View File

@@ -15,11 +15,9 @@ X_poly = zeros(numel(X), p);
%
%
for i = 1:p
X_poly(:, i) = X.^i;
end
% =========================================================================
end
end

Binary file not shown.

View File

@@ -41,10 +41,12 @@ error_val = zeros(length(lambda_vec), 1);
for i = 1:length(lambda_vec)
lambda = lambda_vec(i);
[theta] = trainLinearReg(X, y, lambda);
error_train(i) = linearRegCostFunction(X, y, theta, 0);
error_val(i) = linearRegCostFunction(Xval, yval, theta, 0);
end