# Confusion-matrix clarification from Python

confusion_matrix(y_test1, pred)
That is my codes

Confusion matrix, without normalization
True     [[724258    438]
value    [ 25396    302]]
Predicted value


I understand that is how this is the confusion matrix. But I do not know the order of classification result.

0   [[724258    438]                1 [[724258    438]
1   [ 25396    302]]                0 [ 25396    302]]
0         1                        1        0


Which order generally? I check the documentation, it does not tell me the specific result.

it's the first one

0   [[724258    438]
1   [ 25396    302]]
0         1


According to the documentation

sklearn.metrics.confusion_matrix(y_true, y_pred, labels=None, sample_weight=None)


labels : array, shape = [n_classes], optional List of labels to index the matrix. This may be used to reorder or select a subset of labels. If none is given, those that appear at least once in y_true or y_pred are used in sorted order.

• I am also curious what Happen if it is three labels such as 0, 1, 2. Will still follow like that? May 10, 2018 at 18:08
• yup, "If none is given, those that appear at least once in y_true or y_pred are used in """"sorted order""""" May 10, 2018 at 18:13