Use the diabetes dataset to perform linear regression. ● Insteadof using linear_model.LinearRegression() from sklearn, create yourown function to return the gradient and the best-fit liney-intercept. ○ m = (μ(x) * μ(y) − μ(x * y))/((μ(x)) μ(x )) 2 − 2 ○b = μ(y) − m * μ(x) ○ Where μ is a mean function ● Reserve the last20 observations for testing and use the rest for training yourmodel. ● Produce a figure with the following: ○ Scatter plot oftraining data colored red. ○ Scatter plot of testing data coloredgreen. ○ Line graph for the best-fit line colored blue. ○Legend
PLEASE HELP!!!!
THANK YOU IN ADVANCE
Expert Answer
Answer to Use the diabetes dataset to perform linear regression. ● Instead of using linear_model.LinearRegression() from sklearn…