Polynomial regression | Computer Science homework help
In this problem, we write a program to estimate the parameters for an unknown polynomial using the polyfit() function of the numpy package.
1)Please plot the noisy data and the polynomial you found (in the same figure). You can use any value of m selected from 2, 3, 4, 5, 6.
2)Plot MSE versusorder m,for m = 1, 2, 3, 4, 5, 6, 7, 8respectively.Identify the best choice of m.
3)Change variable noise_scaleto 150, 200, 400, 600, 1000 respectively,re-run the algorithm and plot the polynomialswith the m found in 2). Discuss the impact of noise scale to the accuracy of the returned parameters.[You need to plot a figure like in 1) for each choice of noise_scale.]
4)Change variable number_of_samplesto 40, 30, 20, 10 respectively, re-ran the algorithm and plot the polynomialswith the m found in 2). Discuss the impact of the number of samples to the accuracy of the returned parameters.[You need to plot a figure like in 1) for each choice of number_of_samples.]A simulateddataset will be providedas below.The polynomial used is y = 5 * x + 20 * x2+ x3.Simulated data is given as follows in Python:import matplotlib.pyplot as pltplt.style.use(‘seaborn-whitegrid’)import numpy as npnoise_scale = 100number_of_samples = 50x = 25*(np.random.rand(number_of_samples, 1) -0.8)y = 5 * x + 20 * x**2 + 1 * x**3 + noise_scale*np.random.randn(number_of_samples, 1)plt.plot(x,y,’ro’)

How it Works

1
It only takes a couple of minutes to fill in your details, select the type of paper you need (essay, term paper, etc.), give us all necessary information regarding your assignment.


2
Once we receive your request, one of our customer support representatives will contact you within 24 hours with more specific information about how much it'll cost for this particular project.


3
After receiving payment confirmation via PayPal or credit card – we begin working on your detailed outline, which is based on the requirements given by yourself upon ordering.


4
Once approved, your order is complete and will be emailed directly to the email address provided before payment was made!