Challenge: Putting It All Together
In this challenge, apply the full workflow learned in the course β from data preprocessing through training to model evaluation.
Swipe to start coding
You are working with a penguin dataset. Build an ML pipeline to classify species with KNN, handling encoding, missing values, scaling, and tuning.
- Encode
ywithLabelEncoder. - Split with
train_test_split(test_size=0.33). - Make
ct:OneHotEncoderon'island','sex',remainder='passthrough'. - Set
param_gridforn_neighbors,weights,p. - Create
GridSearchCV(KNeighborsClassifier(), param_grid). - Pipeline:
ctβSimpleImputer('most_frequent')βStandardScalerβGridSearchCV. - Fit on train.
- Print test
.score. - Predict, print first 5 decoded labels.
- Print
.best_estimator_.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.13
Challenge: Putting It All Together
Swipe to show menu
In this challenge, apply the full workflow learned in the course β from data preprocessing through training to model evaluation.
Swipe to start coding
You are working with a penguin dataset. Build an ML pipeline to classify species with KNN, handling encoding, missing values, scaling, and tuning.
- Encode
ywithLabelEncoder. - Split with
train_test_split(test_size=0.33). - Make
ct:OneHotEncoderon'island','sex',remainder='passthrough'. - Set
param_gridforn_neighbors,weights,p. - Create
GridSearchCV(KNeighborsClassifier(), param_grid). - Pipeline:
ctβSimpleImputer('most_frequent')βStandardScalerβGridSearchCV. - Fit on train.
- Print test
.score. - Predict, print first 5 decoded labels.
- Print
.best_estimator_.
Solution
Thanks for your feedback!
single