How to use Boosting to Improve Tree Model Performance in Sklearn

03.04.2021

Intro

Boosting is an alternative technique that builds up tree models. You can use this in place of random forest to increase performance over basic tree models. In this article, we will learn how to use AdaBoost to increase our tree model performance in Sklearn.

Using Boosting

To use AdaBoost, we can use the class AdaBoostClassifier. We fit these models like any other model in sklearn. We can also do the same with AdaBoostRegressor if we are predicted a contious value instead of classifying.

from sklearn.ensemble import AdaBoostClassifier
from sklearn import datasets


iris = datasets.load_iris()
features = iris.data
target = iris.target

adaboost = AdaBoostClassifier(random_state=0)

model = adaboost.fit(features, target)
print(model.score())