Scikit-learn's Adaboost implementations exist in the sklearn.ensemble package, in the AdaBoostClassifier and AdaBoostRegressor classes.
Like all scikit-learn classifiers, we use the fit and predict functions in order to train the classifier and predict on the test set. The first parameter is the base classifier that the algorithm will use. The algorithm="SAMME" parameter forces the classifier to use a discrete boosting algorithm. For this example, we use the hand-written digits recognition problem:
# --- SECTION 1 ---# Libraries and data loadingimport numpy as npfrom sklearn.datasets import load_digitsfrom sklearn.tree import DecisionTreeClassifierfrom sklearn.ensemble import AdaBoostClassifierfrom sklearn import metricsdigits ...