Question: Write a python code and can run on Colab: Build 5 different regression models from the building blocks in this module, and measure their accuracy

Write a python code and can run on Colab:
Build 5 different regression models from the building blocks in this module, and measure their accuracy on a training, validation, and test set.
Use the same training and test split (with same seed), and use a validation set to do any hyperparameter tuning.
The code for splitting of test and training dataset :
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)
The code for dataset:
from sklearn import datasets, linear_model
diabetes = datasets.load_diabetes()
# Use cross-validation for hyperparameter selection
Example:
regr = linear_model.ElasticNetCV(cv=5, random_state=1, l1_ratio=[.1,.5,.7,.9,.95,.99,1])
Then, visualize the accuracy of your 5 models as a barplot, with differentsubfiguresfor the accuracy on your (a) training, (b) validation, and (c) test data.
Last, discuss the results and whether the models are under- or over-fitting.

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!