18 lines
362 B
Matlab
18 lines
362 B
Matlab
%% This loads our data
|
|
[X, y] = load_data_ex2();
|
|
|
|
%% Normalise and initialize.
|
|
[X, mean_vec, std_vec] = normalise_features(X);
|
|
|
|
%after normalising we add the bias
|
|
X = [ones(size(X, 1), 1), X];
|
|
|
|
%initialise theta
|
|
theta = [0.0, 0.0, 0.0];
|
|
alpha = 0.1;
|
|
iterations = 100;
|
|
|
|
%%
|
|
t = gradient_descent(X, y, theta, alpha, iterations);
|
|
disp 'Press enter to exit!';
|
|
pause; |