Scikit-learn has a great implementation of bagging for both regression and classification problems. In this section, we will go through the process of using the provided implementations to create ensembles for the digits and diabetes datasets.
Using scikit-learn
Bagging for classification
Scikit-learn's implementation of bagging lies in the sklearn.ensemble package. BaggingClassifier is the corresponding class for classification problems. It has a number of interesting parameters, allowing for greater flexibility. It can use any scikit-learn estimator by specifying it with base_estimator. Furthermore, n_estimators dictates the ensemble's size (and, consequently, the number of bootstrap samples that will be generated...