Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Creating a Pipeline | Pipelines
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Machine Learning with Python

bookChallenge: Creating a Pipeline

Use the original penguins.csv: first remove the two rows with insufficient data. Build one preprocessing pipeline that performs encoding, imputing, and scaling.

Only 'sex' and 'island' should be encoded, so use a ColumnTransformer. After that, apply SimpleImputer and StandardScaler to all features.

Here is a reminder of the make_column_transformer() and make_pipeline() functions you will use.

Task

Swipe to start coding

  1. Import make_pipeline.
  2. Create ct using OneHotEncoder for 'sex' and 'island', with remainder='passthrough'.
  3. Build a pipeline: ct β†’ SimpleImputer('most_frequent') β†’ StandardScaler.
  4. Transform X and store the result in X_transformed.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Creating a Pipeline

Swipe to show menu

Use the original penguins.csv: first remove the two rows with insufficient data. Build one preprocessing pipeline that performs encoding, imputing, and scaling.

Only 'sex' and 'island' should be encoded, so use a ColumnTransformer. After that, apply SimpleImputer and StandardScaler to all features.

Here is a reminder of the make_column_transformer() and make_pipeline() functions you will use.

Task

Swipe to start coding

  1. Import make_pipeline.
  2. Create ct using OneHotEncoder for 'sex' and 'island', with remainder='passthrough'.
  3. Build a pipeline: ct β†’ SimpleImputer('most_frequent') β†’ StandardScaler.
  4. Transform X and store the result in X_transformed.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

some-alt