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
Can you explain the steps involved in the full workflow shown here?
What is the purpose of each tool or method depicted in the images?
Can you provide a summary of how these components work together in a machine learning project?
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