Assume I have trained two machine learning models both use random forest but one of them is for classification and the other is for prediction. I would like to do first the classification and if the output is 2 then the predication. I would like to use one pipeline for that (besides pipeline everything works well) to convert the model to PMML file. I am wondering as how to implement the pipeline for this(since there are two models per say and are separated with if and else statement) and ideally I would like to have one pipeline to do both.
For example I have something like this for each pipeline but do not know how to combine them with the if-else statement.
Pipe1 = Pipeline([('scaler', StandardScaler()),('classifier', RandomForestRegressor())])
Pipe2 = Pipeline([('classifier', RandomForestClassifier())])
After performing the prediction phase for the classification if the output is 2 then run the second pipeline.
Aucun commentaire:
Enregistrer un commentaire