code: def compute_metrics(
      forecasts: np.ndarray,
      dataset: EvaluationDataset,
      quantiles: List[str],
      seasonality: int,
  ) -> Dict[str, float]:
      """
      Evaluates the forecasts on the provided dataset and returns summary metrics.
  
      Parameters
      ----------
      forecasts: np.ndarray, shape: [n_time_series, prediction_length, n_quantiles]
          The per time-series forecasts. The forecasts *must* align with the time series of the
          given dataset. Otherwise, behavior is undefined.
      dataset: EvaluationDataset
          The dataset for which to evaluate the metrics.
      quantiles: List[str]
          A list containing the quantiles predicted in the forecast
      seasonality: int
          The seasonality of the data.
  
      Returns
      -------
      Dict
          The evaluation of the forecasts.
      """
      assert len(forecasts) > 0, "At least one forecast must be given."
      assert len(forecasts) == len(
          dataset.future
      ), "The number of forecasts does not match the number of time series in the dataset."
      median = forecasts[:, :, forecasts.shape[-1] // 2]
      # Compute seasonal error for MASE computation
      seasonal_error = naive_error(dataset.past, seasonality)
  
      # Compute all the metrics
      results = {
          # normalized deviation (see e.g. DeepAR paper)
          "nd": abs_error_sum(median, dataset.future)
          / abs_target_sum(dataset.future),
          "nrmse": rmse(median, dataset.future)
          / abs_target_mean(dataset.future),
          "mase": mase(median, dataset.future, seasonal_error),
          "smape": smape(median, dataset.future),
          "mean_weighted_quantile_loss": mean_weighted_quantile_loss(
              forecasts.transpose((0, 2, 1)),
              dataset.future,
              quantiles=quantiles,
          ),
      }
      return results
  
file_path: gluonts/src/gluonts/nursery/few_shot_prediction/src/meta/metrics/numpy.py
imports: import math
  import numpy
  import numpy.ma
  from typing import List, Dict
  from meta.datasets.splits import EvaluationDataset
label_desc: Use image node_id 9 for calling a global function with example usage: compute_metrics(forecasts, dataset, quantiles, seasonality) and returns: results