Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Predicting Passenger Survival in Titanic Shipwreck

13 / 21

Titanic Machine Learning Project - Build the Pipeline for the Categorical Attributes

Now let us build the pipeline for the categorical attributes:


Import OneHotEncoder from sklearn.preprocessing

from << your code goes here >> import OneHotEncoder

Now save the pipeline we create for categorical attributes in a variable named cat_pipeline:

<< your code goes here >> = Pipeline([
        ("select_cat", DataFrameSelector(["Pclass", "Sex", "Embarked"])),
        ("imputer", MostFrequentImputer()),
        ("cat_encoder", OneHotEncoder(sparse=False)),

Now fit the training data into this pipeline:

cat_pipeline.fit_transform(<< your code goes here >>)

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...