Секція 1. Розділ 32
single
Challenge: Putting It All Together
Свайпніть щоб показати меню
In this challenge, apply the full workflow learned in the course — from data preprocessing through training to model evaluation.
Завдання
Проведіть, щоб почати кодувати
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. Forn_neighborsbetter to use odd values of integers. - 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_.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 32
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат