1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 2

CAB212 · Unit 2: Regression

Regression metrics: MAE, MSE, RMSE and R-squared

8 practice questions

Key points

  • MAE robust; MSE punishes large errors
  • RMSE in target units
  • R2 = 1 - SS_res/SS_tot
  • R2 can be negative

For true values y and predictions p over n samples:

  • MAE = mean(|y - p|): average absolute error, same units as y, robust to outliers.
  • MSE = mean((y - p)^2): penalizes large errors heavily.
  • RMSE = sqrt(MSE): same units as y.
  • R-squared = 1 - SS_res / SS_tot, where SS_res = sum((y - p)^2) and SS_tot = sum((y - y_mean)^2). It is the fraction of variance explained.

Worked example: y=[2,4,6,8], p=[3,4,5,10]. Errors 1,0,-1,2. MAE = 1.0, MSE = 1.5, RMSE = 1.2247. y_mean=5, SS_tot=20, SS_res=6, so R-squared = 1 - 6/20 = 0.7.

Exam pitfall: R-squared can be negative on test data when the model is worse than predicting the mean.

Try two questions

Question 1 · Tier 2, Understand

Which metric penalizes a single large error most heavily?

  1. Mean absolute deviation
  2. MAE
  3. Median absolute error
  4. MSE
Show the answer

D. Squaring magnifies large errors.

Question 2 · Tier 3, Apply

For the same data the R-squared is:

  1. 1.5
  2. 0.7
  3. 0.85
  4. 0.3
Show the answer

B. SS_res = 6, SS_tot = 20, so 1 - 6/20 = 0.7.