code: def smape(
      y: np.ndarray,
      y_hat: np.ndarray,
      weights: Optional[np.ndarray] = None,
      axis: Optional[int] = None,
  ) -> Union[float, np.ndarray]:
      """Symmetric Mean Absolute Percentage Error
  
      Calculates Symmetric Mean Absolute Percentage Error between
      `y` and `y_hat`. SMAPE measures the relative prediction
      accuracy of a forecasting method by calculating the relative deviation
      of the prediction and the observed value scaled by the sum of the
      absolute values for the prediction and observed value at a
      given time, then averages these devations over the length
      of the series. This allows the SMAPE to have bounds between
      0% and 200% which is desirable compared to normal MAPE that
      may be undetermined when the target is zero.
  
      $$ \mathrm{sMAPE}_{2}(\\mathbf{y}_{\\tau}, \\mathbf{\hat{y}}_{\\tau}) = \\frac{1}{H} \\sum^{t+H}_{\\tau=t+1} \\frac{|y_{\\tau}-\hat{y}_{\\tau}|}{|y_{\\tau}|+|\hat{y}_{\\tau}|} $$
  
      **Parameters:**<br>
      `y`: numpy array, Actual values.<br>
      `y_hat`: numpy array, Predicted values.<br>
      `mask`: numpy array, Specifies date stamps per serie to consider in loss.<br>
  
      **Returns:**<br>
      `smape`: numpy array, (single value).
  
      **References:**<br>
      [Makridakis S., "Accuracy measures: theoretical and practical concerns".](https://www.sciencedirect.com/science/article/pii/0169207093900793)
      """
      _metric_protections(y, y_hat, weights)
  
      delta_y = np.abs(y - y_hat)
      scale = np.abs(y) + np.abs(y_hat)
      smape = _divide_no_nan(delta_y, scale)
      smape = 2 * np.average(smape, weights=weights, axis=axis)
  
      if isinstance(smape, float):
          assert smape <= 2, "SMAPE should be lower than 200"
      else:
          assert all(smape <= 2), "SMAPE should be lower than 200"
  
      return smape
  
file_path: neuralforecast/neuralforecast/losses/numpy.py
imports: from typing import Optional, Union
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: smape(y, y_hat, weights, axis) and returns: smape