Description
1) Linear Regression (3 points) Load the linearreg.csv file. This is the file you will use for this problem. There are two vectors in the file X and Y. X consists of 30 instances of a univariate attribute vector, and Y is the response vector. The intent of this problem is to get hands on experience doing polynomial regression (and its limits) and to use cross-validation to get an idea of how model complexity relates to bias/variance/MSE.
A. (2 point) Using n-fold cross-validation (the value of n is your choice, but must be explained in your answer) with kth polynomial regression, fit a function to the data for values of k between 0 and 9. In your homework, show the plot of the mean square error on the validation set(s), averaged over all of the folds, as a function of k. Also, plot the best function overlaying a scatterplot of the data. The code for your work must be in a single file called nfoldpolyfit.py. The stub for this file has been provided to you as an example. Below is the function signature, as well as how it will be run from the command line def nfoldpolyfit(X,Y,maxK,n, verbose) python nfoldpolyfit.py