Question: Problem 1. Linear regression using the diabetes data set [1]: import numpy as np from sklearn import datasets, linear_model import matplotlib.pyplot as plt # Load
Problem 1. Linear regression using the diabetes data set [1]: import numpy as np from sklearn import datasets, linear_model import matplotlib.pyplot as plt \# Load the diabetes dataset diabetes_ x, diabetes y= datasets.load_diabetes (return_x_y=True) (a) Print the number of data instances and features in this data set. (b) Use the third feature as the only input feature and split the data into traininglesting sets. (c) Create a linear regression model and fit it to the training data. (d) Predict outputs for the testing data set. (e) Find the weight and intercept values and print them. (f) Plot the test data points using pltscatter and draw the "line of best fit" using plt.plot(). (g) Select two suitable evaluation metrics and report the generalization error using the test data set. (h) Do we get a better model if we use all input features instead of one? You can repeat the training/evaluation process to verify
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
