Machine Learning with Swift
上QQ阅读APP看书,第一时间看更新

Confusion matrix

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:

The bigger the numbers on the matrix diagonally, the better.