def residual_variance(y_true, y_pred):
    """
    Manual calculation of residual variance. It is obtained calculating the square error for every entry of every point,
    summarizing all of them and then dividing the sum for n-2, where n is the length of the array.
    Please refer to this specification: https://www.coursera.org/lecture/regression-models/residual-variance-WMAET
    :param y_true: ground truth
    :param y_pred: the estimated y
    :return: float, residual variance of our model
    """
    sum = 0
    for idx, value in enumerate(y_true):
        sum += (value - y_pred[idx]) ** 2
    return float(sum / len(y_true))