turicreate.evaluation.confusion_matrix

turicreate.evaluation.confusion_matrix(targets, predictions)

Compute the confusion matrix for classifier predictions.

Parameters:
targets : SArray

Ground truth class labels (cannot be of type float).

predictions : SArray

The prediction that corresponds to each target value. This vector must have the same length as targets. The predictions SArray cannot be of type float.

Returns:
out : SFrame

An SFrame containing counts for ‘target_label’, ‘predicted_label’ and ‘count’ corresponding to each pair of true and predicted labels.

See also

accuracy

Examples

>>> targets = turicreate.SArray([0, 1, 1, 0])
>>> predictions = turicreate.SArray([1, 0, 1, 0])
>>> turicreate.evaluation.confusion_matrix(targets, predictions)