Question: We will now perform cross - validation on a simulated dataset. ( a ) 4 p t s Generate a simulated dataset as follows: def
We will now perform crossvalidation on a simulated dataset.
a Generate a simulated dataset as follows:
def fx:
return xx
nprandom.seed
x nprandom.uniform size
y fx nprandom.normal size
b Create a scatterplot of against Comment on what you find. Hint: You
may find plot helpful
cpts Set a random seed and then compute the LOOCV errors that result from
fitting the polynomial functions of degree from to using the simulated data in a:
vdots
cdots
Hint: See Section in ISLP for an example of how to implement crossvalidation in
Python. You may find
from sklearn.modelselection import crossvalidate
from ISLP.models import sklearnsm
helpful
dpts Repeat c using another random seed and report your results. Are your
results the same as what you got in c Why?
epts Which of the models in c had the smallest LOOCV error? Is this what you
expected? Explain your answer.
fpts Fit using least squares. Comment on the coefficient estimates and their
statistical significance.
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
