code: def mean_absolute_percentage_error(
      y_true,
      y_pred,
      *,
      sample_weight=None,
      multioutput="uniform_average",
  ):
      """Mean absolute percentage error (MAPE) regression loss.
  
      Note here that the output is not a percentage in the range [0, 100]
      and a value of 100 does not mean 100% but 1e2. Furthermore, the output
      can be arbitrarily high when `y_true` is small (which is specific to the
      metric) or when `abs(y_true - y_pred)` is large (which is common for most
      regression metrics). Read more in the
      :ref:`User Guide <mean_absolute_percentage_error>`.
  
      .. versionadded:: 0.24
  
      Parameters
      ----------
      y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
          Ground truth (correct) target values.
  
      y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)
          Estimated target values.
  
      sample_weight : array-like of shape (n_samples,), default=None
          Sample weights.
  
      multioutput : {'raw_values', 'uniform_average'} or array-like
          Defines aggregating of multiple output values.
          Array-like value defines weights used to average errors.
          If input is list then the shape must be (n_outputs,).
  
          'raw_values' :
              Returns a full set of errors in case of multioutput input.
  
          'uniform_average' :
              Errors of all outputs are averaged with uniform weight.
  
      Returns
      -------
      loss : float or ndarray of floats
          If multioutput is 'raw_values', then mean absolute percentage error
          is returned for each output separately.
          If multioutput is 'uniform_average' or an ndarray of weights, then the
          weighted average of all output errors is returned.
  
          MAPE output is non-negative floating point. The best value is 0.0.
          But note that bad predictions can lead to arbitrarily large
          MAPE values, especially if some `y_true` values are very close to zero.
          Note that we return a large value instead of `inf` when `y_true` is zero.
  
      Examples
      --------
      >>> from sklearn.metrics import mean_absolute_percentage_error
      >>> y_true = [3, -0.5, 2, 7]
      >>> y_pred = [2.5, 0.0, 2, 8]
      >>> mean_absolute_percentage_error(y_true, y_pred)
      0.3273...
      >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
      >>> y_pred = [[0, 2], [-1, 2], [8, -5]]
      >>> mean_absolute_percentage_error(y_true, y_pred)
      0.5515...
      >>> mean_absolute_percentage_error(y_true, y_pred, multioutput=[0.3, 0.7])
      0.6198...
      >>> # the value when some element of the y_true is zero is arbitrarily high because
      >>> # of the division by epsilon
      >>> y_true = [1., 0., 2.4, 7.]
      >>> y_pred = [1.2, 0.1, 2.4, 8.]
      >>> mean_absolute_percentage_error(y_true, y_pred)
      112589990684262.48
      """
      y_type, y_true, y_pred, multioutput = _check_reg_targets(
          y_true, y_pred, multioutput
      )
      check_consistent_length(y_true, y_pred, sample_weight)
      epsilon = np.finfo(np.float64).eps
      mape = np.abs(y_pred - y_true) / np.maximum(
          np.abs(y_true), epsilon
      )
      output_errors = np.average(mape, weights=sample_weight, axis=0)
      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 warnings
  from numbers import Real
  import numpy
  from scipy.special import xlogy
  from ..exceptions import UndefinedMetricWarning
  from ..utils._param_validation import Hidden, Interval, StrOptions, validate_params
  from ..utils.stats import _weighted_percentile
  from ..utils.validation import _check_sample_weight, _num_samples, check_array, check_consistent_length, column_or_1d
label_desc: Use image node_id 4 for calling a global function with example usage: mean_absolute_percentage_error(y_true, y_pred) and returns: np, output_errors