Avsnitt 1. Kapitel 20
single
Challenge: Creating a Pipeline
Svep för att visa menyn
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.
Uppgift
Svep för att börja koda
- Import
make_pipeline. - Create
ctusingOneHotEncoderfor'sex'and'island', withremainder='passthrough'. - Build a pipeline:
ct→SimpleImputer('most_frequent')→StandardScaler. - Transform
Xand store the result inX_transformed.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 20
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal