OURCE BEGIN #####
    %% Linear Regression with Polynomial Basis of different degrees
% based on code code by Romain Thibaux
% (Lecture 2 from http://www.cs.berkeley.edu/~asimma/294-fall06/)
%%

% This file is from pmtk3.googlecode.com



N = 21;
[xtrain, ytrain, xtest, ytestNoisefree, ytest] = ...
    polyDataMake('sampling','thibaux', 'n', N);


%degs = 0:2:20;
degs = 1:20;
Nm = length(degs);

%% Plot error vs degree
mseTrain = zeros(1,Nm); mseTest = zeros(1,Nm);
for m=1:length(degs)
    deg = degs(m);
  