Question: Problem 2 : Load the data set Q consisting of a single explanatory variable ( boldsymbol { x } ) and dependent
Problem :
Load the data set Q consisting of a single explanatory variable boldsymbolx and dependent variable boldsymboly
Shuffle the rows of Q and separate the data into a test set and training set. Use of the data for the testing set and the remaining for training set.
: Q npgenfromtxtdataLStxtdelimiter
nprandom.shuffle#### use polyfit
Build different models on the training set, each of different degree polynomials boldsymbolp With each model:
a Print a graph of the data with a graph of the model. Use blue for training data, red for the testing data and use black for the model.
b Below the graph, print the model parameters and the mean of the squared error on the testing set.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
