I'm looking for a Python library that can compute the confusion matrix for multi-label classification.
FYI:
- scikit-learn doesn't support multi-label for confusion matrix)
- What is the difference between Multiclass and Multilabel Problem
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityI'm looking for a Python library that can compute the confusion matrix for multi-label classification.
FYI:
Also take a look at scikit-multilearn. It is a very good library that extends sklearn for multi-label learning. However, I'm not sure how the confusion matrix works for multi-label problems...
This guy claims he has solved it.
Although this question is old, I am writing this answer for new audience.
scikit-learn now supports confusion matrix for multi-label classification.
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.multilabel_confusion_matrix.html
There are many different parameters which can evaluate the performance of your method by comparing the real and predicted labels. I suggest PyCM module which can give a vast variety these parameters which are suitable for multi-class classification.
Sklearn has a method for it using which you can compute confusion matrix for multi class.
from sklearn import cross_validation
confusion_matrix(original, Predicted)
Scikit-learn does support multi-label confusion matrix. See the links below for documentation and user guide:
http://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html
http://scikit-learn.org/stable/modules/model_evaluation.html#confusion-matrix
Look at sed_eval library. It is developed for evaluating event detection in audio which is a multi-label problem (as in each audio, multiple events exist). They have many evaluation options, which might fit to your needs. You can get the true-positive rate, ... and from there computing the confusion matrix is not that hard.