Project - Predicting Titanic Passenger Survival using Machine Learning and Python

11 / 21

Titanic Machine Learning Project - Create Pipeline for the Numerical Attributes

Let's build the pipeline for the numerical attributes:


Create the pipeline and save it in a variable named num_pipeline:

from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer

<< your code goes here >> = Pipeline([
        ("select_numeric", DataFrameSelector(["Age", "SibSp", "Parch", "Fare"])),
        ("imputer", SimpleImputer(strategy="median")),

Now fit the training data in this pipeline:

num_pipeline.fit_transform(<< your code goes here >>)
Get Hint See Answer

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

Loading comments...