Train the AdaBoost classifier

Now that you've instantiated the AdaBoost classifier ada, it's time train it. You will also predict the probabilities of obtaining the positive class in the test set. This can be done as follows:

Once the classifier ada is trained, call the .predict_proba() method by passing X_test as a parameter and extract these probabilities by slicing all the values in the second column as follows:

ada.predict_proba(X_test)[:,1]

The Indian Liver dataset is processed for you and split into 80% train and 20% test. Feature matrices X_train and X_test, as well as the arrays of labels y_train and y_test are available in your workspace. In addition, we have also loaded the instantiated model ada from the previous exercise.

This exercise is part of the course

Machine Learning with Tree-Based Models in Python

View Course

Exercise instructions

  • Fit ada to the training set.

  • Evaluate the probabilities of obtaining the positive class in the test set.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Fit ada to the training set
____

# Compute the probabilities of obtaining the positive class
y_pred_proba = ____.____(____)[____]