def symmetric_mean_absolute_percentage_error(y_true, y_pred):
    """Compute the symmetric mean absolute percentage error (SMAPE).

    Parameters
    ----------
    y_true : array-like, shape (n_samples,)
        Ground truth (correct) target values.

    y_pred : array-like, shape (n_samples,)
        Estimated target values.

    Returns
    -------
    smape : float
    """
    e = np.abs(y_true - y_pred)
    return (e / (np.abs(y_true) + np.abs(y_pred))).mean()
Compute the symmetric mean absolute percentage error (SMAPE).

    Parameters
    ----------
    y_true : array-like, shape (n_samples,)
        Ground truth (correct) target values.

    y_pred : array-like, shape (n_samples,)
        Estimated target values.

    Returns
    -------
    smape : float
    
optbinning/metrics/regression.py