Hi Nayan,
It's easy - see the sklearn2pmml.ensemble.SelectFirstClassifier estimator type:
https://github.com/jpmml/sklearn2pmml/blob/0.61.0/sklearn2pmml/ensemble/__init__.py#L181-L199
>
> if some_condition == True:
> score = x
> return(score)
> else:
> score = Decision_Tree(x)
> return(score)
>
As the name suggests, SelectFirstClassifier returns the prediction of
the first child estimator whose "controlling predicate" evaluates to
True. For constant prediction you could use a
sklearn.dummy.DummyClassifier estimator.
Something like this:
classifier = SelectFirstClassifier([
("condition", "X['A1'] == 'Beta'", DummyClassifier(..)),
("default", "True", DecisionTreeClassifier(..))
])
Villu