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

single

bookChallenge: Putting It All Together

Scorri per mostrare il menu

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

Compito

Scorri per iniziare a programmare

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

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 32
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt