Search code examples
pythonmachine-learningscikit-learnpipelineensemble-learning

Is it possible to average the output of multiple classification models using pipeline in sklearn?


As an example, suppose there is a random forest and a logistic regression model that accept the same input data, and I want the inference result to be the average of the probabilities of these two models.

In this case, is it possible to create a pipeline that outputs the average probabilities of the two models as shown above?


Solution

  • A VotingClassifier with voting="soft" will work for this purpose.