Join Data Science Interview MasterClass (July Cohort) led by FAANG Data Scientists | Just 2 seats remaining...
Data Science MasterClass (July) | 2 seats left
Last Updated: April 2024
How do you evaluate regression model metrics?
1. Mean Squared Error (MSE) – Calculates the average squared difference between the actual values (y_i) and the predicted values (y_hat_i) for all samples. Lower MSE indicates a better fit. But, MSE is sensitive to outliers given the squaring errors amplifies the differences.
MSE = 1/n * Σ(y_i - y_hat_i)^2where:
2. Root Mean Squared Error (RMSE) – Square root of MSE. Makes the errors easier to interpret in the original units of your data, especially when dealing with non-negative targets (e.g., housing prices).
RMSE = sqrt(MSE)3. Mean Absolute Error (MAE) – Calculates the average absolute difference between actual and predicted values. Less sensitive to outliers compared to MSE.
MAE = 1/n * Σ|y_i - y_hat_i|4. R-squared (Coefficient of Determination) – Represents the proportion of variance in the target variable explained by the model. Ranges from 0 to 1, with a higher value indicating a better fit. However, it’s important to note that R² can increase by simply adding more features, even if they are not relevant.
R² = 1 - Σ(y_i - y_hat_i)² / Σ(y_i - y_mean)² where y_mean is the average of the actual values.5. Adjusted R-squared – A modification of R² that penalizes for adding more features to the model, helping to avoid overfitting. Generally considered a more reliable measure of fit compared to the standard R².
Choosing the Right Metrics
The choice of metrics depends on several factors:


