Confusion matrix6/17/2023 ![]() ![]() ![]() ![]() Scikit-Learn provides a confusion_matrix function from trics import confusion_matrix How can I make this for multiple classes?įor example, for a data set with three classes, it should return: ,] If I run this code for a multiple classed data, it doesn't work. What my code is trying to do is: i get prob_arr and input_arr and for each class (1 and 2) I check if they are misclassified or not.īut my code only works for two classes. Input_arr is the original class labels for a dataset and it is like this: Prob_arr is an array that my classification code returned and a sample array is like this: I wrote a confusion matrix calculation code in Python: def conf_mat(prob_arr, input_arr):Īccuracy = float(conf_arr + conf_arr)/(len(input_arr)) ![]()
0 Comments
Leave a Reply. |