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 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.modelselection import traintestsplit
Xtrain, Xtest, ytrain, ytest traintestsplitX y testsize randomstate
The code for dataset:
from sklearn import datasets, linearmodel
diabetes datasets.loaddiabetes
# Use crossvalidation for hyperparameter selection
Example:
regr linearmodel.ElasticNetCVcv randomstate lratio
Then, visualize the accuracy of your 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 overfitting.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
