def adj_r2(r2, n, p):
    """
    Calculates the adjusted R^2 regression metric
    Params:
    r2: The unadjusted r2
    n: Number of data points
    p: number of features
    """
    adj_r2 = 1 - (1 - r2) * (n - 1) / (n - p - 1)
    return adj_r2