Confusion Matrix

Confusion Matrix Binary

evaluations.classification.confusion_matrix.confusion_matrix_binary(y_true: List[int], y_pred: List[int]) → Dict[str, int]

Compute tp, tn, fp, fn

Parameters
  • y_true (list of ints) – True labels

  • y_pred (list os ints) – Predicted labels

Returns

Dictionary with number of samples of tp, tn, fp, fn

Return type

Dict[str, int]

Examples

>>> from evaluations.classification import confusion_matrix_binary
>>> confusion_matrix_binary([1, 1, 0, 0], [1, 0, 0, 1])
{'tp': 1, 'tn': 1, 'fp': 1, 'fn': 1}