nltk.ConfusionMatrix.__init__

ConfusionMatrix.__init__(reference, test, sort_by_count=False)[source]

Construct a new confusion matrix from a list of reference values and a corresponding list of test values.

Parameters:
  • reference (list) – An ordered list of reference values.
  • test (list) – A list of values to compare against the corresponding reference values.
Raises:

ValueError – If reference and length do not have the same length.