import math

from sklearn import metrics


def mse(y, y_pred) -> float:
    return float(metrics.mean_squared_error(y, y_pred))


def rmse(y, y_pred) -> float:
    return float(math.sqrt(metrics.mean_squared_error(y, y_pred)))


def mae(y, y_pred) -> float:
    return float(metrics.mean_absolute_error(y, y_pred))


def rmae(y, y_pred) -> float:
    return float(math.sqrt(metrics.mean_absolute_error(y, y_pred)))


def r2(y, y_pred) -> float:
    return float(metrics.r2_score(y, y_pred))
