Modelling if condition of multiple estimators in a pipeline

How to correctly model a if condition to choose estimator/predictor(linear regression, gbt) to be used in scikit/spark-ml in a single pipeline.

if feature_x  constant: 
    result = pipeline1.predict(feature_vector)
else:
    result = pipeline2.predict(feature_vector)

Other than modelling it as custom transformer/predictor, is there a alternate way to model it in a pipeline


Topic data-product apache-spark scikit-learn python

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.