code: def calculate_mean_average_precision_at_r(
      self,
      knn_labels,
      query_labels,
      not_lone_query_mask,
      ref_includes_query,
      label_counts,
      **kwargs,
  ):
      knn_labels, query_labels = try_getting_not_lone_labels(
          knn_labels, query_labels, not_lone_query_mask
      )
      if knn_labels is None:
          return nan_accuracy(label_counts[0], self.return_per_class)
      return mean_average_precision(
          knn_labels,
          query_labels[:, None],
          ref_includes_query,
          label_counts,
          self.avg_of_avgs,
          self.return_per_class,
          self.label_comparison_fn,
          at_r=True,
      )
  
imports: import torch
  from sklearn.metrics import adjusted_mutual_info_score, normalized_mutual_info_score
  from .None import common_functions
  from .inference import FaissKMeans, FaissKNN
label_desc: Use image node_id 10 for calling the AccuracyCalculator obj's underlying member method code with example usage: obj.calculate_mean_average_precision_at_r(knn_labels, query_labels, not_lone_query_mask, ref_includes_query, label_counts) and returns: mean_average_precision, nan_accuracy