Evaluate Bagging performance
Now that you instantiated the bagging classifier, it's time to train it and evaluate its test set accuracy.
The Indian Liver Patient dataset is processed for you and split into 80% train and 20% test. The 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 bagging classifier bc that you instantiated in the previous exercise and the function accuracy_score() from sklearn.metrics.
Latihan ini adalah bagian dari kursus
Machine Learning with Tree-Based Models in Python
Petunjuk latihan
Fit
bcto the training set.Predict the test set labels and assign the result to
y_pred.Determine
bc's test set accuracy.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Fit bc to the training set
____.____(____, ____)
# Predict test set labels
y_pred = ____.____(____)
# Evaluate acc_test
acc_test = ____(____, ____)
print('Test set accuracy of bc: {:.2f}'.format(acc_test))