Sektion 1. Kapitel 20
single
Challenge: Creating a Pipeline
Stryg for at vise menuen
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.
Opgave
Swipe to start coding
- 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 alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 20
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat