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

single

bookChallenge: Putting It All Together

Glissez pour afficher le menu

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

Tâche

Glissez pour commencer à coder

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_.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 32
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt