There's more...

Here, we will showcase training a model using AdaBoost with a support vector machine (SVM) as the base learner. 

By default, AdaBoost uses a decision tree as the base learner. We can use different base learners as well. In the following example, we have used an SVM as our base learner with the AdaBoost algorithm. We use SVC with rbf as the kernel:

from sklearn.svm import SVCAdaboost_with_svc_rbf = AdaBoostClassifier(n_estimators=100, base_estimator=SVC(probability=True, kernel='rbf'), learning_rate=1, random_state=0)Adaboost_with_svc_rbf.fit(X_train, Y_train)

We can check the accuracy and the AUC values of our AdaBoost model with support vector classifier (SVC) as the base learner:

# Mean accuracyprint('The mean accuracy is: ...

Get Ensemble Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.