code: def plot_heldout_prediction(input_vals, probs, fname, n=10, title=""):
      """Save a PNG plot visualizing posterior uncertainty on heldout data.
  
      Args:
        input_vals: A `float`-like Numpy `array` of shape
          `[num_heldout] + IMAGE_SHAPE`, containing heldout input images.
        probs: A `float`-like Numpy array of shape `[num_monte_carlo,
          num_heldout, num_classes]` containing Monte Carlo samples of
          class probabilities for each heldout sample.
        fname: Python `str` filename to save the plot to.
        n: Python `int` number of datapoints to vizualize.
        title: Python `str` title for the plot.
      """
      fig = figure.Figure(figsize=(9, 3 * n))
      canvas = backend_agg.FigureCanvasAgg(fig)
      for i in range(n):
          ax = fig.add_subplot(n, 3, 3 * i + 1)
          ax.imshow(
              input_vals[i, :].reshape(IMAGE_SHAPE[:-1]),
              interpolation="None",
          )
  
          ax = fig.add_subplot(n, 3, 3 * i + 2)
          for prob_sample in probs:
              sns.barplot(
                  x=np.arange(10), y=prob_sample[i, :], alpha=0.1, ax=ax
              )
              ax.set_ylim([0, 1])
          ax.set_title("posterior samples")
  
          ax = fig.add_subplot(n, 3, 3 * i + 3)
          sns.barplot(
              x=np.arange(10), y=np.mean(probs[:, i, :], axis=0), ax=ax
          )
          ax.set_ylim([0, 1])
          ax.set_title("predictive probs")
      fig.suptitle(title)
      fig.tight_layout()
  
      canvas.print_figure(fname, format="png")
      print("saved {}".format(fname))
  
imports: import os
  import warnings
  from absl import app
  from absl import flags
  import matplotlib
  from matplotlib import figure
  from matplotlib.backends import backend_agg
  import numpy
  import tensorflow.compat.v2
  import tensorflow_probability
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 2 for calling a global function with example usage: plot_heldout_prediction(input_vals, probs, fname, n, title) without return types