code: def run_precision_recall_analysis(
      main_eval,
      exact_raw,
      f1_raw,
      na_probs,
      qid_to_has_ans,
      out_image_dir,
  ):
      if out_image_dir and not os.path.exists(out_image_dir):
          os.makedirs(out_image_dir)
      num_true_pos = sum(1 for v in qid_to_has_ans.values() if v)
      if num_true_pos == 0:
          return
      pr_exact = make_precision_recall_eval(
          exact_raw,
          na_probs,
          num_true_pos,
          qid_to_has_ans,
          out_image=os.path.join(out_image_dir, "pr_exact.png"),
          title="Precision-Recall curve for Exact Match score",
      )
      pr_f1 = make_precision_recall_eval(
          f1_raw,
          na_probs,
          num_true_pos,
          qid_to_has_ans,
          out_image=os.path.join(out_image_dir, "pr_f1.png"),
          title="Precision-Recall curve for F1 score",
      )
      oracle_scores = {k: float(v) for k, v in qid_to_has_ans.items()}
      pr_oracle = make_precision_recall_eval(
          oracle_scores,
          na_probs,
          num_true_pos,
          qid_to_has_ans,
          out_image=os.path.join(out_image_dir, "pr_oracle.png"),
          title="Oracle Precision-Recall curve (binary task of HasAns vs. NoAns)",
      )
      merge_eval(main_eval, pr_exact, "pr_exact")
      merge_eval(main_eval, pr_f1, "pr_f1")
      merge_eval(main_eval, pr_oracle, "pr_oracle")
  
imports: import argparse
  import collections
  import json
  import numpy
  import os
  import re
  import string
  import sys
label_desc: Use image node_id 14 for calling a global function with example usage: run_precision_recall_analysis(main_eval, exact_raw, f1_raw, na_probs, qid_to_has_ans, out_image_dir) without return types