code: def relative_loss(
      y_true,
      y_pred,
      relative_loss_function=mean_absolute_error,
      horizon_weight=None,
      multioutput="uniform_average",
      **kwargs,
  ):
      """Relative loss of forecast versus benchmark forecast for a given metric.
  
      Applies a forecasting performance metric to a set of forecasts and
      benchmark forecasts and reports ratio of the metric from the forecasts to
      the the metric from the benchmark forecasts. Relative loss output is
      non-negative floating point. The best value is 0.0.
  
      If the score of the benchmark predictions for a given loss function is zero
      then a large value is returned.
  
      This function allows the calculation of scale-free relative loss metrics.
      Unlike mean absolute scaled error (MASE) the function calculates the
      scale-free metric relative to a defined loss function on a benchmark
      method instead of the in-sample training data. Like MASE, metrics created
      using this function can be used to compare forecast methods on a single
      series and also to compare forecast accuracy between series.
  
      This is useful when a scale-free comparison is beneficial but the training
      data used to generate some (or all) predictions is unknown such as when
      comparing the loss of 3rd party forecasts or surveys of professional
      forecasters.
  
      Only metrics that do not require y_train are currently supported.
  
      Parameters
      ----------
      y_true : pd.Series, pd.DataFrame or np.array of shape (fh,) or (fh, n_outputs) \
               where fh is the forecasting horizon
          Ground truth (correct) target values.
  
      y_pred : pd.Series, pd.DataFrame or np.array of shape (fh,) or (fh, n_outputs) \
               where fh is the forecasting horizon
          Forecasted values.
  
      y_pred_benchmark : pd.Series, pd.DataFrame or np.array of shape (fh,) or \
               (fh, n_outputs) where fh is the forecasting horizon, default=None
          Forecasted values from benchmark method.
  
      relative_loss_function : function, default=mean_absolute_error
          Function to use in calculation relative loss. The function must comply
          with API interface of sktime forecasting performance metrics. Metrics
          requiring y_train or y_pred_benchmark are not supported.
  
      horizon_weight : array-like of shape (fh,), default=None
          Forecast horizon weights.
  
      multioutput : {'raw_values', 'uniform_average'}  or array-like of shape \
              (n_outputs,), default='uniform_average'
          Defines how to aggregate metric for multivariate (multioutput) data.
          If array-like, values used as weights to average the errors.
          If 'raw_values', returns a full set of errors in case of multioutput input.
          If 'uniform_average', errors of all outputs are averaged with uniform weight.
  
      Returns
      -------
      relative_loss : float
          Loss for a method relative to loss for a benchmark method for a given
          loss metric.
          If multioutput is 'raw_values', then relative loss is returned for each
          output separately.
          If multioutput is 'uniform_average' or an ndarray of weights, then the
          weighted average relative loss of all output errors is returned.
  
      References
      ----------
      Hyndman, R. J and Koehler, A. B. (2006). "Another look at measures of
      forecast accuracy", International Journal of Forecasting, Volume 22, Issue 4.
  
      Examples
      --------
      >>> import numpy as np
      >>> from sktime.performance_metrics.forecasting import relative_loss
      >>> from sktime.performance_metrics.forecasting import mean_squared_error
      >>> y_true = np.array([3, -0.5, 2, 7, 2])
      >>> y_pred = np.array([2.5, 0.0, 2, 8, 1.25])
      >>> y_pred_benchmark = y_pred*1.1
      >>> relative_loss(y_true, y_pred, y_pred_benchmark=y_pred_benchmark)
      0.8148148148148147
      >>> relative_loss(y_true, y_pred, y_pred_benchmark=y_pred_benchmark, \
      relative_loss_function=mean_squared_error)
      0.5178095088655261
      >>> y_true = np.array([[0.5, 1], [-1, 1], [7, -6]])
      >>> y_pred = np.array([[0, 2], [-1, 2], [8, -5]])
      >>> y_pred_benchmark = y_pred*1.1
      >>> relative_loss(y_true, y_pred, y_pred_benchmark=y_pred_benchmark)
      0.8490566037735847
      >>> relative_loss(y_true, y_pred, y_pred_benchmark=y_pred_benchmark, \
      multioutput='raw_values')
      array([0.625     , 1.03448276])
      >>> relative_loss(y_true, y_pred, y_pred_benchmark=y_pred_benchmark, \
      multioutput=[0.3, 0.7])
      0.927272727272727
      """
      y_pred_benchmark = _get_kwarg(
          "y_pred_benchmark", metric_name="relative_loss", **kwargs
      )
      _, y_true, y_pred, multioutput = _check_reg_targets(
          y_true, y_pred, multioutput
      )
  
      if horizon_weight is not None:
          check_consistent_length(y_true, horizon_weight)
  
      loss_preds = relative_loss_function(
          y_true,
          y_pred,
          horizon_weight=horizon_weight,
          multioutput=multioutput,
      )
      loss_benchmark = relative_loss_function(
          y_true,
          y_pred_benchmark,
          horizon_weight=horizon_weight,
          multioutput=multioutput,
      )
      return np.divide(loss_preds, np.maximum(loss_benchmark, EPS))
  
imports: import numpy
  from scipy.stats import gmean
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import median_absolute_error
  from sklearn.metrics._regression import _check_reg_targets
  from sklearn.utils.stats import _weighted_percentile
  from sklearn.utils.validation import check_consistent_length
  from sktime.utils.stats import _weighted_geometric_mean
label_desc: Use image node_id 22 for calling a global function with example usage: relative_loss(y_true, y_pred, relative_loss_function, horizon_weight, multioutput) and returns: np