4.1. Exercises
Is it Overfitting or Underfitting?
Overfitting and Underfitting True or False
Overfitting/Underfitting in Action!
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.
Letโs examine our validation scores and training scores a bit more carefully and assess if our model is underfitting or overfitting.
This time we are looking at a new data set that contains the basketball players in the NBA. We are only going to use the players with a position of Guard (G) or Forward (F). We will be using features height, weight and salary to try to predict the playerโs position, Guard or Forward.
Letโs take a quick look at it before diving in.
Tasks:
- Cross-validate using
cross_validate()on the objectsX_trainandy_trainmaking sure to specify 10 folds andreturn_train_score=True. - Convert the scores into a dataframe and save it in an object named
scores_df. - Calculate the mean value of each column and save this in an object named
mean_scores. - Answer the question below.