4.1. Exercises
Pipeline Questions
Pipeline True or False
Applying Pipelines
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 trusty basketball letโs impute, scale and fit a model using a pipeline to see the results.
Tasks:
- Build a pipeline named
bb_pipeit should impute usingSimpleImputerand a โmedianโ strategy, scale usingStandardScalerand build aKNeighborsClassifier. - Cross-validate on
bb_pipeusingX_trainandy_trainand save the results in an object namedcross_scores. - Transform
cross_scoresto a dataframe, take the mean of each column and save the result in an object named mean_scores.