confusion_matrix#

cuml.metrics.confusion_matrix(
y_true,
y_pred,
labels=None,
sample_weight=None,
normalize=None,
) ndarray[source]#

Compute confusion matrix to evaluate the accuracy of a classification.

Parameters:
y_truearray-like (device or host) shape = (n_samples,)

Ground truth (correct) target values.

y_predarray-like (device or host) shape = (n_samples,)

Estimated target values.

labelsarray-like (device or host) shape = (n_classes,), optional

List of labels to index the matrix. This may be used to reorder or select a subset of labels. If None is given, those that appear at least once in y_true or y_pred are used in sorted order.

sample_weightarray-like (device or host) shape = (n_samples,), optional

Sample weights.

normalizestring in [‘true’, ‘pred’, ‘all’] or None (default=None)

Normalizes confusion matrix over the true (rows), predicted (columns) conditions or all the population. If None, confusion matrix will not be normalized.

Returns:
Ccupy.ndarray of shape (n_classes, n_classes)

Confusion matrix on device.