code: def median_absolute_scaled_error(
      y_true,
      y_pred,
      sp=1,
      horizon_weight=None,
      multioutput="uniform_average",
      **kwargs,
  ):
      """Median absolute scaled error (MdASE).
  
      MdASE output is non-negative floating point. The best value is 0.0.
  
      Taking the median instead of the mean of the test and train absolute errors
      makes this metric more robust to error outliers since the median tends
      to be a more robust measure of central tendency in the presence of outliers.
  
      Like MASE and other scaled performance metrics this scale-free metric can be
      used to compare forecast methods on a single series or between series.
  
      Also like MASE, this metric is well suited to intermittent-demand series
      because it will not give infinite or undefined values unless the training
      data is a flat timeseries. In this case the function returns a large value
      instead of inf.
  
      Works with multioutput (multivariate) timeseries data
      with homogeneous seasonal periodicity.
  
      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_train : pd.Series, pd.DataFrame or np.array of shape (n_timepoints,) or \
               (n_timepoints, n_outputs), default = None
          Observed training values.
  
      sp : int
          Seasonal periodicity of training data.
  
      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.
  
      See Also
      --------
      mean_absolute_scaled_error
      mean_squared_scaled_error
      median_squared_scaled_error
  
      Returns
      -------
      loss : float or ndarray of floats
          MdASE loss.
          If multioutput is 'raw_values', then MdASE is returned for each
          output separately.
          If multioutput is 'uniform_average' or an ndarray of weights, then the
          weighted average MdASE 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.
  
      Hyndman, R. J. (2006). "Another look at forecast accuracy metrics
      for intermittent demand", Foresight, Issue 4.
  
      Makridakis, S., Spiliotis, E. and Assimakopoulos, V. (2020)
      "The M4 Competition: 100,000 time series and 61 forecasting methods",
      International Journal of Forecasting, Volume 3.
  
      Examples
      --------
      >>> from sktime.performance_metrics.forecasting import median_absolute_scaled_error
      >>> y_train = np.array([5, 0.5, 4, 6, 3, 5, 2])
      >>> y_true = [3, -0.5, 2, 7]
      >>> y_pred = [2.5, 0.0, 2, 8]
      >>> median_absolute_scaled_error(y_true, y_pred, y_train=y_train)
      0.16666666666666666
      >>> y_train = np.array([[0.5, 1], [-1, 1], [7, -6]])
      >>> y_true = np.array([[0.5, 1], [-1, 1], [7, -6]])
      >>> y_pred = np.array([[0, 2], [-1, 2], [8, -5]])
      >>> median_absolute_scaled_error(y_true, y_pred, y_train=y_train)
      0.18181818181818182
      >>> median_absolute_scaled_error(y_true, y_pred, y_train=y_train, \
      multioutput='raw_values')
      array([0.10526316, 0.28571429])
      >>> median_absolute_scaled_error( y_true, y_pred, y_train=y_train, \
      multioutput=[0.3, 0.7])
      0.21935483870967742
      """
      y_train = _get_kwarg(
          "y_train",
          metric_name="median_absolute_scaled_error",
          **kwargs,
      )
  
      # Other input checks
      _, 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)
  
      if y_train.ndim == 1:
          y_train = np.expand_dims(y_train, 1)
  
      # Check test and train have same dimensions
      if y_true.ndim != y_train.ndim:
          raise ValueError(
              "Equal dimension required for y_true and y_train"
          )
  
      if (y_true.ndim > 1) and (y_true.shape[1] != y_train.shape[1]):
          raise ValueError(
              "Equal number of columns required for y_true and y_train"
          )
  
      # naive seasonal prediction
      y_train = np.asarray(y_train)
      y_pred_naive = y_train[:-sp]
  
      # mean absolute error of naive seasonal prediction
      mdae_naive = median_absolute_error(
          y_train[sp:], y_pred_naive, multioutput=multioutput
      )
  
      mdae_pred = median_absolute_error(
          y_true,
          y_pred,
          horizon_weight=horizon_weight,
          multioutput=multioutput,
      )
      return mdae_pred / np.maximum(mdae_naive, 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 5 for calling a global function with example usage: median_absolute_scaled_error(y_true, y_pred, sp, horizon_weight, multioutput) and returns: unknown