2
$\begingroup$
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.

$\endgroup$

1 Answer 1

1
$\begingroup$

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.

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.