prediction_to_labels_and_confidence#

ethograph.labels.predictions.prediction_to_labels_and_confidence(pred)[source]#

Convert prediction array to dense labels and optional confidence.

Parameters:

pred (np.ndarray) – Shape (T, n_classes) for softmax probabilities, or (T,) for dense labels.

Return type:

tuple[np.ndarray, np.ndarray | None]

Returns:

  • labels (np.ndarray, shape (T,)) – Dense integer labels (argmax for softmax input).

  • confidence (np.ndarray or None) – Shape (T,) confidence scores. For softmax input: 1 - normalized_entropy. None if input is already dense labels.