Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Putting It All Together | Section
Machine Learning Foundations with Scikit-Learn
Sectie 1. Hoofdstuk 32
single

single

bookChallenge: Putting It All Together

Veeg om het menu te tonen

In this challenge, apply the full workflow learned in the course — from data preprocessing through training to model evaluation.

Taak

Veeg om te beginnen met coderen

You are working with a penguin dataset. Build an ML pipeline to classify species with KNN, handling encoding, missing values, scaling, and tuning.

  1. Encode y with LabelEncoder.
  2. Split with train_test_split(test_size=0.33).
  3. Make ct: OneHotEncoder on 'island', 'sex', remainder='passthrough'.
  4. Set param_grid for n_neighbors, weights, p. For n_neighbors better to use odd values of integers.
  5. Create GridSearchCV(KNeighborsClassifier(), param_grid).
  6. Pipeline: ctSimpleImputer('most_frequent')StandardScalerGridSearchCV.
  7. Fit on train.
  8. Print test .score.
  9. Predict, print first 5 decoded labels.
  10. Print .best_estimator_.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 32
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt