6.1. Exercises

Dummy Regressors

Dummy Regressor Scores

Below are the values for y that were used to train DummyRegressor(strategy='mean'):

Grade
0     75
1     80
2     90
3     95
4     85
dtype: int64

Building a Dummy Regressor

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 build a baseline model by using DummyRegressor().

Tasks:

  • Build a baseline model using the DummyRegressor() and mean for the strategy argument. Save this in an object named model.
  • Fit your model and then predict on the target column.
  • What is the accuracy of the model to 2 decimal places? Save this in the object accuracy.
Hint 1
  • Are using DummyRegressor(strategy='mean')?
  • Are you using the model named model?
  • Are you calling .fit(X,y) on your model?
  • Are you using model.score(X,y) to find the accuracy?
Fully worked solution: