Skip to content
heliaEDGE
Reference
HELIA

confusion_matrix

Classes

Name Description
ConfusionMatrix Accumulates a confusion matrix and returns row-normalized values.

Machine-readable model

  • ConfusionMatrixclassAccumulate class counts and return a row-normalized confusion matrix.
class

Accumulate class counts and return a row-normalized confusion matrix.

helia_edge/metrics/confusion_matrix.py:14

ConfusionMatrix(num_classes: int, name='confusion_matrix', **kwargs={})

Accumulate class counts and return a row-normalized confusion matrix.

Rows represent true classes and columns represent predicted classes. Rows with no observations return zeros. State accumulates across batches until reset_state() is called.

Parameters of ConfusionMatrix
NameTypeDefaultDescription
num_classesintRequiredNumber of classes, defining both matrix dimensions.
namestr'confusion_matrix'Keras metric name.
**kwargsAny{}Additional Keras Metric arguments, including state dtype.
method

Add a batch of labels and predictions to the accumulated counts.

helia_edge/metrics/confusion_matrix.py:39

update_state(y_true, y_pred, sample_weight=None)

Add a batch of labels and predictions to the accumulated counts.

Parameters of update_state
NameTypeDefaultDescription
y_trueTensorRequiredInteger class labels, flattened before accumulation.
y_predTensorRequiredClass scores with shape (batch, ..., num_classes), reduced with argmax over the last axis, or matching integer labels.
sample_weightTensor | NoneNoneOptional weights, flattened to one value per label.
Errors raised by update_state
TypeDescription
ValueErrorA true or predicted label is outside the class range in eager execution. TensorFlow graph execution uses an assertion.