code: def make_results_dataframe(
      predictions: jax.Array,
      y_test: jax.Array,
      y_train: jax.Array,
      p2_5: jax.Array,
      p90: jax.Array,
      p97_5: jax.Array,
  ) -> pd.core.frame.DataFrame:
      """Compute metrics and put into a dataframe for serialization.
  
      Note that all data is expected to be untransformed.
  
      Args:
        predictions: Unscaled predictions of the data.
        y_test: Unscaled testing data.
        y_train: Unscaled training data.
        p2_5: 2.5th percentile prediction.
        p90: 90th percentile prediction.
        p97_5: 97.5th percentile prediction.
  
      Returns:
        Dataframe with predictions and metrics.
      """
      y_test = y_test.squeeze()
      y_train = y_train.squeeze()
      n_test = len(y_test)
  
      # Write metrics to dataframe
      # TODO(ursk): Compute the correct metrics for each dataset here, i.e.
      # 'm3': [smape, mase, msis],
      # 'traffic': [wmppl, wmape],
      # 'm5': [wrmsse, wspl]
      smapes = np.array(
          [
              metrics.smape(y_test[:i], predictions[:i])
              for i in range(1, n_test + 1)
          ]
      )
      mases = np.array(
          [
              metrics.mase(y_test[:i], predictions[:i], y_train, 12)
              for i in range(1, n_test + 1)
          ]
      )
      msises = np.array(
          [
              metrics.msis(y_test[:i], p2_5[:i], p97_5[:i], y_train, 12)
              for i in range(1, n_test + 1)
          ]
      )
      return pd.DataFrame(
          data=np.array(
              [
                  predictions,
                  p2_5,
                  p90,
                  p97_5,
                  y_test,
                  smapes,
                  mases,
                  msises,
              ]
          ).T,
          columns=[
              "yhat",
              "yhat_lower",
              "p90",
              "yhat_upper",
              "y",
              "smape",
              "mase",
              "msis",
          ],
      )
  
imports: import functools
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import bayeux
  import jax
  import jax.numpy
  from jaxtyping import PyTree
  import matplotlib.pyplot
  import numpy
  import pandas
  from tensorflow_probability.python.experimental.autobnn import bnn
  from tensorflow_probability.python.experimental.autobnn import util
  from tensorflow_probability.python.experimental.timeseries import metrics
  import tensorflow_probability.substrates.jax
label_desc: Use image node_id 8 for calling a global function with example usage: make_results_dataframe(predictions, y_test, y_train, p2_5, p90, p97_5) and returns: pd