Data Science, Machine Learning, Regression, Evaluation Metric, Linear Regression.
would do it: def adjusted_r_squared(r2, X): # It takes as input the R² score and the X dataframe, containing independent features n = X.shape[0] # Obtaining the number of samples in the X dataframe k = X.shape[1] # Obtaining the number of independent variables in the X dataframe R2_adj = 1 - ((1 -