autointent.metrics.scoring.scoring_hit_rate#

autointent.metrics.scoring.scoring_hit_rate(labels, scores)#

Calculate hit rate for multilabel classification.

Hit rate measures the fraction of cases where the top-ranked label is in the set of true labels for the instance.

\[\text{Hit Rate} = \frac{1}{N} \sum_{i=1}^N \mathbb{1}(y_{\text{top},i} \in y_{\text{true},i})\]
Parameters:
  • labels (autointent.metrics.custom_types.LABELS_VALUE_TYPE) – Ground truth labels for each sample.

  • scores (autointent.metrics.custom_types.SCORES_VALUE_TYPE) – For each sample, scores for each of n_classes classes.

Returns:

Hit rate score.

Return type:

float