napkinxc.measures.hamming_loss

napkinxc.measures.hamming_loss(Y_true, Y_pred)[source]

Calculate unnormalized (to avoid very small numbers because of large number of labels) hamming loss - average number of misclassified labels.

Parameters:
  • Y_true (ndarray, csr_matrix, list[list|set[int|str]]) – Ground truth provided as a matrix with non-zero values for true labels or a list of lists or sets of true labels.

  • Y_pred (ndarray, csr_matrix, list[list|set[int|str]], list[list|set[tuple[int|str, float]]) – Predicted labels provided as a matrix with scores or list of lists of labels or tuples of labels with scores (label, score).

Returns:

Value of hamming loss.

Return type:

float