function [w] = graddescent_simple(X, Y, w_init)
  
  w = w_init;
  epsilon = 0.000001;
  for iteration = 1 : 5000 %<- in practice, use some stopping criterion!
    %COMPUTE GRADIENT
    grad = zeros(size(X,1),1);
    for ii = 1 : size(X,2)
      grad = grad + 2 * (w'*X(:,ii) - Y(ii)) * X(:,ii);
    end;

    %TAKE STEP
    w = w - epsilon * grad;

    %OUTPUT THE CURRENT ERROR:
    err = 0;
    for ii = 1 : size(X,2)
      err = err + (Y(ii) - w'*X(:,ii))^2;
    end;
    err

  end;


