code: def geometric_mean_squared_error(
      y_true,
      y_pred,
      horizon_weight=None,
      multioutput="uniform_average",
      square_root=False,
      **kwargs,
  ):
      """Geometric mean squared error (GMSE) or Root geometric mean squared error (RGMSE).
  
      If `square_root` is False then calculates GMSE and if `square_root` is True
      then RGMSE is calculated. Both GMSE and RGMSE return non-negative floating
      point. The best value is approximately zero, rather than zero.
  
      Like MSE and MdSE, GMSE is measured in squared units of the input data. RMdSE is
      on the same scale as the input data like RMSE and RdMSE. Because GMSE and RGMSE
      square the forecast error rather than taking the absolute value, they
      penalize large errors more than GMAE.
  
      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.
  
      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.
  
      square_root : bool, default=False
          Whether to take the square root of the mean squared error.
          If True, returns root geometric mean squared error (RGMSE)
          If False, returns geometric mean squared error (GMSE)
  
      Returns
      -------
      loss : float
          GMSE or RGMSE loss. If multioutput is 'raw_values', then loss is returned
          for each output separately. If multioutput is 'uniform_average' or an ndarray
          of weights, then the weighted average MdSE of all output errors is returned.
  
      See Also
      --------
      mean_absolute_error
      median_absolute_error
      mean_squared_error
      median_squared_error
      geometric_mean_absolute_error
  
      Notes
      -----
      The geometric mean uses the product of values in its calculation. The presence
      of a zero value will result in the result being zero, even if all the other
      values of large. To partially account for this in the case where elements
      of `y_true` and `y_pred` are equal (zero error), the resulting zero error
      values are replaced in the calculation with a small value. This results in
      the smallest value the metric can take (when `y_true` equals `y_pred`)
      being close to but not exactly zero.
  
      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 \
      geometric_mean_squared_error as gmse
      >>> y_true = np.array([3, -0.5, 2, 7, 2])
      >>> y_pred = np.array([2.5, 0.0, 2, 8, 1.25])
      >>> gmse(y_true, y_pred)  # doctest: +SKIP
      2.80399089461488e-07
      >>> gmse(y_true, y_pred, square_root=True)  # doctest: +SKIP
      0.000529527232030127
      >>> y_true = np.array([[0.5, 1], [-1, 1], [7, -6]])
      >>> y_pred = np.array([[0, 2], [-1, 2], [8, -5]])
      >>> gmse(y_true, y_pred)  # doctest: +SKIP
      0.5000000000115499
      >>> gmse(y_true, y_pred, square_root=True)  # doctest: +SKIP
      0.5000024031086919
      >>> gmse(y_true, y_pred, multioutput='raw_values')  # doctest: +SKIP
      array([2.30997255e-11, 1.00000000e+00])
      >>> gmse(y_true, y_pred, multioutput='raw_values', \
      square_root=True)  # doctest: +SKIP
      array([4.80621738e-06, 1.00000000e+00])
      >>> gmse(y_true, y_pred, multioutput=[0.3, 0.7])  # doctest: +SKIP
      0.7000000000069299
      >>> gmse(y_true, y_pred, multioutput=[0.3, 0.7], \
      square_root=True)  # doctest: +SKIP
      0.7000014418652152
      """
      _, y_true, y_pred, multioutput = _check_reg_targets(
          y_true, y_pred, multioutput
      )
      errors = y_true - y_pred
      errors = np.where(errors == 0.0, EPS, errors)
      if horizon_weight is None:
          output_errors = gmean(np.square(errors), axis=0)
      else:
          check_consistent_length(y_true, horizon_weight)
          output_errors = _weighted_geometric_mean(
              np.square(errors), weights=horizon_weight, axis=0
          )
  
      if square_root:
          output_errors = np.sqrt(output_errors)
  
      if isinstance(multioutput, str):
          if multioutput == "raw_values":
              return output_errors
          elif multioutput == "uniform_average":
              # pass None as weights to np.average: uniform mean
              multioutput = None
  
      return np.average(output_errors, weights=multioutput)
  
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 13 for calling a global function with example usage: geometric_mean_squared_error(y_true, y_pred, horizon_weight, multioutput, square_root) and returns: np, output_errors