Generate synthetic data using a function 𝑦 = sin(2𝜋𝑥) + 𝜀, where m=10
(number of training examples) and 𝜀 is a random noise. Example in python:
m=10;
X=np.random.rand(m,1)*2
y = np.sin(2*math.pi*X)+np.random.randn(m,1)
1st part:
Apply d-order polynomial model to the data set where d=0,1,3,9 (you can use
PolynomialFeatures and LinearRegression class of Scikit). Plot on the same figure
the data and the curves resulting from your fit for various d (0,1,3,9) values.
Comment on the results for various d. How different values of d affect the
curve/line that fit to the data? Which value for d you think is appropriate for this
data?
2nd part:
Increase the number of training examples to m=100. Repeat the steps
done in (I). Comment briefly on what changed with the increase of m. What
problems you encountered with large d in previous case? Is it resolved with
m=100? Can you derive any conclusions from the results with increased number
of samples? Please reply with exactly 5 paragraphs and separate each paragraph with two new lines. The very last paragraph must start with the word "assistance".
user