1.1. Exercises
Linear Regression Questions
True or False: Ridge
Using Ridge
Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.
When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.
Make sure you remove the hash (#) symbol in the coding portions of this question. We have commented them so that the line wonβt execute and you can test your code after each step.
Using our well know basketball dataset, we are going to build a model using the height feature and assess if it can help predict a playerβsweight.
Tasks:
- Create a MAPE scorer from the
mapefunction that we provided. Make sure you specify in the scorer that lower numbers are better for MAPE. - Build a Ridge model called
ridge_bb. - Use
GridSearchCVto hyperparameter tunealpha. Fill the blanks so it usesridge_bbas an estimator and the values fromparam_dist. - Fit your grid search on the training data.
- What is the best value for
alpha? Save it in an object namedbest_alpha. - What is the best MAPE score? Save it in an object named
best_mape.