简体   繁体   中英

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM