Files
QMUL_Machine_Learning/mllab2.m
T
2016-10-19 11:01:34 +01:00

19 lines
363 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;