econ
econ

Reputation: 515

Python-ML:confusion_matrix from sklrearn

I know what confusion matrix is and how to use it. From documentation and some other examples I understand how binary confusion is set up(C(0,0)= "upper left place in matrix" = predicted:false, actual false =false nefgatives). I alsu assume "actual" is always on y axis and "predicted" on x axis. But what is C(0,0) in multinomial case, when I have for examle 4x4 matrix? I notices it goes by alphabetical order from left to right on x axise and toward bottom in y axis, if first letter are the same second letter decides by alphabetical order, is this correct?

Upvotes: 0

Views: 111

Answers (1)

Miriam Farber
Miriam Farber

Reputation: 19634

Yes, based on the github repository, unless you specify otherwise, the order is sorted (thus in particular alphabetical).

Specifically, according to the link above:

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.

where labels is one of the inputs to the confusion matrix function:

confusion_matrix(y_true, y_pred, labels=None, sample_weight=None)

Upvotes: 1

Related Questions