
    Djm                     $    d dl mZ ddlZdgZd Zy)   )check_endog    Nsmapec                     t        | dd      } t        |dd      }t        j                  || z
        }t        j                  |dz  t        j                  |      t        j                  |       z   z        S )ac  Compute the Symmetric Mean Absolute Percentage Error.

    The symmetric mean absolute percentage error (SMAPE) is an accuracy measure
    based on percentage (or relative) errors. Defined as follows:

        :math:`\frac{100\%}{n}\sum_{t=1}^{n}{\frac{|F_{t}-A_{t}|}{
        (|A_{t}|+|F_{t}|)/2}}`

    Where a perfect SMAPE score is 0.0, and a higher score indicates a higher
    error rate.

    Parameters
    ----------
    y_true : array-like, shape=(n_samples,)
        The true test values of y.

    y_pred : array-like, shape=(n_samples,)
        The forecasted values of y.

    Examples
    --------
    A typical case:
    >>> import numpy as np
    >>> y_true = np.array([0.07533, 0.07533, 0.07533, 0.07533,
    ...                    0.07533, 0.07533, 0.0672, 0.0672])
    >>> y_pred = np.array([0.102, 0.107, 0.047, 0.1,
    ...                    0.032, 0.047, 0.108, 0.089])
    >>> smape(y_true, y_pred)
    42.60306631890196

    A perfect score:
    >>> smape(y_true, y_true)
    0.0

    References
    ----------
    .. [1] https://en.wikipedia.org/wiki/Symmetric_mean_absolute_percentage_error
    F)copypreserve_series   )r   npabsmean)y_truey_predabs_diffs      TC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\pmdarima/metrics.pyr   r   	   sn    N F
 F
 vvfvo&H77HsNbffVnrvvf~&EFHH    )utilsr   numpyr
   __all__r    r   r   <module>r      s     )2Ir   