IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Machine Learning with Tree-Based Models in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Fit ada to the training set.

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Fit ada to the training set
____

# Compute the probabilities of obtaining the positive class
y_pred_proba = ____.____(____)[____]
Modifica ed esegui il codice