nltk.ConfusionMatrix.pretty_format

ConfusionMatrix.pretty_format(show_percents=False, values_in_chart=True, truncate=None, sort_by_count=False)[source]
Returns:

A multi-line string representation of this confusion matrix.

Parameters:
  • truncate (int) – If specified, then only show the specified number of values. Any sorting (e.g., sort_by_count) will be performed before truncation.
  • sort_by_count – If true, then sort by the count of each label in the reference data. I.e., labels that occur more frequently in the reference label will be towards the left edge of the matrix, and labels that occur less frequently will be towards the right edge.

@todo: add marginals?