Soft Voting Classifier
Tree Models & Ensembles DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding Ensemble Learning via Soft Voting, Predict Probabilities, Soft vs Hard Voting, Weighted Averages, Argmax Operation, Base Estimator Heterogeneity, Ensemble Learning, Supervised Learning, Probability Theory, Model Evaluation, Statistics, Voting Classifiers, Bias-Variance Tradeoff, Model Aggregation, Prediction Uncertainty, Classifier Calibration.
Implement a function 'soft voting predict' that takes a list of trained classifier objects and a feature matrix X. The function should return the final class labels based on 'soft voting'. In soft voting, you must average the predicted probabilities (from predict proba) across all classifiers and select the class with the highest average probability.