How do I get the accuracy information from a pandas confusion matrix? I'd like to just have the number. I haven't been able to find it through Google and I'm hoping to just do something like this:
overall_error = 1 - matrix1.accuracy
If I do:
print matrix1.print_stats()
one of the lines will be:
Accuracy: 0.8203
but I can't get just that number without printing a big block of text with the other information.
cm.stats()['overall']['Accuracy']
Should do it (where cm is the matrix you have loaded). As mentioned in the docs, cm.stats() returns an ordered dict instead of a printout.