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
Step by step
Solved in 5 steps