autointent.metrics.retrieval_map_macro#

autointent.metrics.retrieval_map_macro(query_labels, candidates_labels, k=None)#

Calculate the mean average precision at position k for the intersecting labels.

This function internally uses retrieval_map() to calculate the MAP for each query and performs macro-averaging across multiple queries.

Parameters:
  • query_labels (autointent.metrics.custom_types.LABELS_VALUE_TYPE) – For each query, this list contains its class labels

  • candidates_labels (autointent.metrics.custom_types.CANDIDATE_TYPE) – For each query, these lists contain class labels of items ranked by a retrieval model (from most to least relevant)

  • k (int | None) – Number of top items to consider for each query

Returns:

Score of the retrieval metric

Return type:

float