July 2017
Intermediate to advanced
254 pages
6h 29m
English
As with binary classification, confusion matrices are useful for visualizing the types of errors made by the classifier. Precision, recall, and F1 score can also be computed for each of the classes and accuracy for all of the predictions can be calculated. Let's evaluate our classifier's predictions:
# In[8]:predictions = grid_search.predict(X_test)print('Accuracy: %s' % accuracy_score(y_test, predictions))print('Confusion Matrix:')print(confusion_matrix(y_test, predictions))print('Classification Report:')print(classification_report(y_test, predictions))# Out[8]:Accuracy: 0.636255286428Confusion Matrix:[[ 1124 1725 628 65 10] [ 923 6049 6132 583 34] [ 197 3131 32658 3640 137] [ 15 398 6530 8234 ...Read now
Unlock full access