February 2018
Intermediate to advanced
378 pages
10h 14m
English
Confusion matrix helps to see what types of errors occur more often:
In []:
from sklearn.metrics import confusion_matrix
confusion_matrix(y_test, tree_model.predict(X_test))
Out[]:
array([[128, 20],
[ 17, 135]])
This is how to read and interpret such matrices:
| Predicted labels | ||
| True labels | Platyhog | Rabbosaurus |
| Platyhog | 128 | 20 |
| Rabbosaurus | 17 | 135 |
The bigger the numbers on the matrix diagonally, the better.
Read now
Unlock full access