Generates the train & cross validation set errors to plot a learning curve
Maps X (1D vector) into the p-th power