Part2. Goal/Objective: Apply linear regression on a synthetic data of the form y = 0.75x + 2x2 + 1. 1. A) Similar to part one, generate 200 data samples but this time adjust values of x to be in the range of -3 to 3. Plot the data and split into training and testing PART 1 QUESTION FOR REFERENCE IN ATTACHED PHOTO B)Use Linear Regression on the generated data and plot the results. Discuss your findings. C)Combine polynomial features of the generated data using scikit-learn’s Polynomial Features and fit combined features to a linear regression using the training dataset. Generate 100 samples between -3 to 3 with uniform interval that will be used to generate predictions from the fitted model (note: numpy.linespace can be used to generate evenly spaced
Part2. Goal/Objective: Apply linear regression on a synthetic data of the form y = 0.75x + 2x2 + 1.
1. A) Similar to part one, generate 200 data samples but this time adjust values of x to be in the range of -3 to 3. Plot the data and split into training and testing
PART 1 QUESTION FOR REFERENCE IN ATTACHED PHOTO
B)Use Linear Regression on the generated data and plot the results. Discuss your findings.
C)Combine polynomial features of the generated data using scikit-learn’s Polynomial Features and fit combined features to a linear regression using the training dataset. Generate 100 samples between -3 to 3 with uniform interval that will be used to generate predictions from the fitted model (note: numpy.linespace can be used to generate evenly spaced numbers). Compare the model’s prediction with the ground truth by plotting the prediction as a line and the ground truth as data points on the same graph.
Note:
- PolynomialFeatures Reference:
- Be sure to not include_bias when combining polynomial features

![import numpy as np
from
>>> X = np.arange (6).reshape (3, 2)
>>> X
sklearn.preprocessing
array([[0, 1],
[2, 3],
[4, 5]])
>>> poly
>>>poly.fit transform (X)
1.],
6.1
9.],
4.1
3.1
2.1
5., 16., 20., 25.]])
[ 1or 4.,
>>> poly = Polynomial Features interaction_only=True)
>>>poly.fit transform (X)
0.F
=
Polynomial Features (2)
array([[ 1.,
[ 1.,
array([[ 1.,
[ 1.p
[ 1.,
0.f
4.,
1.,
1.s
3.1
5.1
0.f
import Polynomial Features
0.],
0.f
6.].
20.]])](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F95772e06-ab0d-43f8-a39e-ded877530845%2F5e304dcb-2570-4125-9ae4-915ac7324606%2Fbp5js3h_processed.jpeg&w=3840&q=75)

Step by step
Solved in 5 steps









