function w = train(x,y)
% W = TRAIN(X,Y)
% 
% Train a linear regression model: 
% returns the weights W minimizing norm(Y-[1 X]*W)
% X must be a matrix, with one input vector per row
% Y must be a column matrix of output values
% the returned W is a column vector of weights
  n = size(x,1);
  w = pinv([ones(n,1) x])*y;
