def regression_metrics(y_true, y_pred):
    """Compute regression metrics.

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

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

    Returns
    -------
    metrics : dict
        Dictionary of metrics.
    """

    # Explained variance
    variance = explained_variance_score(y_true, y_pred)

    # Mean absolute error
    mae = mean_absolute_error(y_true, y_pred)

    # Mean squared error
    mse = mean_squared_error(y_true, y_pred)

    # Median absolute error
    median_ae = median_absolute_error(y_true, y_pred)

    # R^2 score
    r2 = r2_score(y_true, y_pred)

    # Mean absolute percentage error
    mape = mean_absolute_percentage_error(y_true, y_pred)

    # Mean percentage error
    mpe = mean_percentage_error(y_true, y_pred)

    # Symmetric mean absolute percentage error
    smape = symmetric_mean_absolute_percentage_error(y_true, y_pred)

    # Median absolute percentage error
    mdape = median_absolute_percentage_error(y_true, y_pred)

    # Symmetric meadian absolute percentage error
    smdape = symmetric_median_absolute_percentage_error(y_true, y_pred)

    d_metrics = {
        "Mean absolute error": mae,
        "Mean squared error": mse,
        "Median absolute error": median_ae,
        "Explained variance": variance,
        "R^2": r2,
        "MPE": mpe,
        "MAPE": mape,
        "SMAPE": smape,
        "MdAPE": mdape,
        "SMdAPE": smdape
    }

    return d_metrics
Compute regression metrics.

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

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

    Returns
    -------
    metrics : dict
        Dictionary of metrics.
    
optbinning/metrics/regression.py