The following code shows the way the Pipelines were created.
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.linear_model import LogisticRegression
numeric_features = ['income', 'age', 'debt_ratio']
numeric_transformer = Pipeline(steps=[('scaler', StandardScaler())])
categorical_features = ['employment_type', 'residence_state']
categorical_transformer = Pipeline(steps=[('onehot', OneHotEncoder(handle_unknown='ignore'))])
preprocessor = ColumnTransformer(
transformers=[
('num', numeric_transformer, numeric_features),
('cat', categorical_transformer, categorical_features)
]
)
model = Pipeline(steps=[
('preprocessor', preprocessor),
('classifier', LogisticRegression())
])