function [trainE, testE] = trainNtest(trainX,trainY,testX,testY)
% [TRAINE,TESTE] = TRAINNTEST(TRAINX,TRAINY,TESTX,TESTY)
%
% trains linear model on the set of inouts TRAINX and corresponding
% outputs TRAINY. Then evaluates the target function on the test inputs
% TESTX, and compares to the true values in TESTY. Returns the test and
% training error computed in this process.

  w = train(trainX,trainY);
  trainYpred = predict(trainX,w);
  trainE = mean((trainY-trainYpred).^2);
  testYpred = predict(testX,w);
  testE = mean((testY-testYpred).^2);

