def recall_from_metadata(prediction_titles, all_metadata):
  """Calculates recall for movie suggestions in redial.

  Args:
    prediction_titles: a list of lists containing the titles mentioned in
                       each prediciton.
    all_metadata: the metadata of each redial conversation

  Returns:
    the recall value, a float between 0 and 100
  """
  matches = 0.0
  total = 0.0
  for mentioned_movies, metadata in zip(prediction_titles, all_metadata):
    mentioned_movies = set(mentioned_movies)  # get rid of duplicates
    # Recommendations are movies not menioned by the user themselves
    recs = set(filter(lambda x, md=metadata: x not in md["user_movies"],
                      mentioned_movies))
    # True positives are the recommendations which match the targets
    tp = set(filter(lambda x, md=metadata: x in md["assistant_movies"],
                    recs))
    matches += len(tp)
    total += len(recs)
  return 0 if total == 0 else 100 * matches / total