Question: Use numpy, Matplotlib, and SkLearn 1. Generate 500 random X values from -3 to 3. 2. Generate 500 Y values using distribution y=0.5*X 5 -

Use numpy, Matplotlib, and SkLearn

1. Generate 500 random X values from -3 to 3.

2. Generate 500 Y values using distribution "y=0.5*X5 - X3 - X2 +2+a little bit randomness (both positive and negative) "

e.g.

m = 500 np.random.seed(seed=5) X = 6 * np.random.random(m).reshape(-1, 1) - 3 y = 0.5 * X**5 -X**3- X**2 + 2 + 5*np.random.randn(m, 1)

# y with both positive and negative randomness added

3. Use X and Y as the whole dataset and use 200 samples as testing + 300 samples as training.

Testing and training sets must be disjoint.

4. Try Polynomial Regression (PolynomialFeatures) in SKLearn from of degree 2 and 5 to fit the training data samples.

5. Plot the figures showing your predictions using degree = 2, 5, 8, 10, 20. Include these figures in your report.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!