Define the AdaBoost classifier
In the following exercises you'll revisit the Indian Liver Patient dataset which was introduced in a previous chapter. Your task is to predict whether a patient suffers from a liver disease using 10 features including Albumin, age and gender. However, this time, you'll be training an AdaBoost ensemble to perform the classification task. In addition, given that this dataset is imbalanced, you'll be using the ROC AUC score as a metric instead of accuracy.
As a first step, you'll start by instantiating an AdaBoost classifier.
Latihan ini adalah bagian dari kursus
Machine Learning with Tree-Based Models in Python
Petunjuk latihan
Import
AdaBoostClassifierfromsklearn.ensemble.Instantiate a
DecisionTreeClassifierwithmax_depthset to 2.Instantiate an
AdaBoostClassifierconsisting of 180 trees and setting thebase_estimatortodt.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import DecisionTreeClassifier
from sklearn.tree import DecisionTreeClassifier
# Import AdaBoostClassifier
____
# Instantiate dt
dt = ____(____=____, random_state=1)
# Instantiate ada
ada = ____(base_estimator=____, n_estimators=____, random_state=1)