code: def evaluate_forecasts(
      forecasts: QuantileForecasts, data: EvaluationDataset
  ) -> Evaluation:
      """
      Evaluates the forecasts on the provided dataset and returns the metrics
      averaged over all time series.
  
      Args:
          forecasts: The per time series forecasts. The forecasts *must* align with the time series
              of the given dataset. Otherwise, behavior is undefined.
          dataset: The dataset for which to evaluate the metrics.
  
      Returns:
          The evaluation of the forecasts.
      """
      assert len(forecasts) > 0, "At least one forecast must be given."
      assert len(forecasts) == len(data.future), (
          "The number of forecasts does not match the number of time series in"
          " the dataset."
      )
  
      # Compute seasonal error for MASE computation
      seasonal_error = naive_error(data.past, forecasts.seasonality)
  
      # Compute all the metrics
      results = {
          "nd": abs_error_sum(forecasts.median, data.future)
          / abs_target_sum(data.future),
          "nrmse": rmse(forecasts.median, data.future)
          / abs_target_mean(data.future),
          "mase": mase(forecasts.median, data.future, seasonal_error),
          "smape": smape(forecasts.median, data.future),
          "ncrps": ncrps(forecasts, data.future),
      }
  
      return Evaluation(results)
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/tsbench/forecasts/evaluation.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Dict, List
  import numpy
  from tsbench.config.dataset import EvaluationDataset
  from tsbench.evaluations.metrics import Metric, Performance
  from .metrics import abs_error_sum, abs_target_mean, abs_target_sum, mase, naive_error, ncrps, rmse, smape
  from .quantile import QuantileForecasts
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate_forecasts(forecasts, data) and returns: Evaluation