def recall(tp_count, targets_count):
  """Calculates recall.

  :param tp_count: Number of true positives.
  :param targets_count: Number of targets.
  :return: The recall rate.
  """
  if targets_count == 0:
    return 0.0
  else:
    return tp_count / float(targets_count)