RMSE, MAE & MSE Error Metrics in Regression (Code 843)

⚡ Direct Answer & Key Takeaway

MAE (Mean Absolute Error) averages the absolute residuals sum(|y_i - y_hat_i|)/n, keeping units identical to the target and treating all errors linearly. MSE (Mean Squared Error) averages squared residuals sum((y_i - y_hat_i)^2)/n, heavily penalizing large outlier errors and making optimization smooth. RMSE (Root Mean Squared Error) takes sqrt(MSE) to restore original target units while retaining outlier sensitivity. CBSE Code 843 board numericals require exact step-by-step substitution into all three formulas.

1. MAE: Linear Penalty and Robustness

Mean Absolute Error (MAE) measures average prediction deviation by taking the absolute difference between each observed value and predicted value before dividing by the sample count n. Because MAE applies a linear weight to every residual, doubling an error doubles its contribution to the final score. This linearity makes MAE intuitive for non-technical stakeholders: an MAE of 2.60 marks means predictions miss actual scores by 2.60 marks on average. Furthermore, MAE resists distortion from isolated sensor spikes or data-entry outliers because extreme residuals are never squared. In CBSE board case studies involving noisy housing prices or erratic retail demand where rare outliers should not skew model selection, MAE serves as the preferred evaluation metric.

  • Formula: MAE = (1/n) * sum(|y_i - y_hat_i|), expressed in original target units.
  • Linear Penalty: Every unit of error contributes equally regardless of residual size.
  • Outlier Resilience: Less distorted by rare extreme spikes than MSE or RMSE.

2. MSE and RMSE: Squared Error Sensitivity

Mean Squared Error (MSE) squares every residual prior to averaging, which eliminates negative signs and amplifies large mistakes quadratically. For example, an error of 4 contributes 16 to the MSE sum, whereas an error of 2 contributes only 4. While squaring makes MSE smooth and differentiable for gradient descent optimization, it expresses error in squared units such as square rupees or square marks. Root Mean Squared Error (RMSE) fixes that interpretability issue by taking the square root of MSE, returning the metric to the target's native scale. Because RMSE penalizes large deviations disproportionately, RMSE always exceeds or equals MAE, with a wide gap between them signaling high-error outliers.

  • MSE Formula: (1/n) * sum((y_i - y_hat_i)^2), ideal as a differentiable training loss.
  • RMSE Formula: sqrt(MSE), restoring original target units for stakeholder reporting.
  • Diagnostic Rule: If RMSE >> MAE, investigate large outlier residuals in your test set.

3. Solving Board Regression Numericals

To earn full marks on 3-mark and 4-mark Code 843 regression numericals, construct a four-column residual table before computing final averages. List the actual value (y), predicted value (y_hat), absolute error |y - y_hat|, and squared error (y - y_hat)^2 row by row. In our worked 5-point dataset, the absolute errors [2, 3, 4, 0, 4] sum to 13, yielding MAE = 13 / 5 = 2.60. Squaring those errors yields [4, 9, 16, 0, 16], summing to 45 and giving MSE = 45 / 5 = 9.00. Taking the square root gives RMSE = sqrt(9.00) = 3.00. Showing every intermediate sum prevents arithmetic slips and secures step-marking credit even if a square root is rounded.

  • Step 1: Tabulate y, y_hat, |y - y_hat|, and (y - y_hat)^2 for every observation.
  • Step 2: Divide column totals by n (not n-1) to get MAE and MSE cleanly.
  • Step 3: Take sqrt(MSE) last and attach the original unit to RMSE and MAE.

4. MAE, MSE, and RMSE Calculator on 5-Point Board Dataset

import math

actual = [40, 55, 70, 80, 95]
predicted = [38, 58, 66, 80, 91]
n = len(actual)

abs_errors = [abs(y - y_hat) for y, y_hat in zip(actual, predicted)]
sq_errors = [(y - y_hat) ** 2 for y, y_hat in zip(actual, predicted)]

mae = sum(abs_errors) / n
mse = sum(sq_errors) / n
rmse = math.sqrt(mse)

for i, (y, yh, ae, se) in enumerate(zip(actual, predicted, abs_errors, sq_errors), 1):
    print(f"Obs {i}: y={y}, y_hat={yh}, |e|={ae}, e^2={se}")

print(f"MAE  = {mae:.2f}")
print(f"MSE  = {mse:.2f}")
print(f"RMSE = {rmse:.2f}")

Verified Console / Dry-Run Output:

Obs 1: y=40, y_hat=38, |e|=2, e^2=4
Obs 2: y=55, y_hat=58, |e|=3, e^2=9
Obs 3: y=70, y_hat=66, |e|=4, e^2=16
Obs 4: y=80, y_hat=80, |e|=0, e^2=0
Obs 5: y=95, y_hat=91, |e|=4, e^2=16
MAE  = 2.60
MSE  = 9.00
RMSE = 3.00

5. Worked Board Numerical Table: Computing MAE, MSE & RMSE (n = 5)

ObservationActual (y)Predicted (y_hat)Absolute Error |y - y_hat|Squared Error (y - y_hat)^2
Obs 1403824
Obs 2555839
Obs 37066416
Obs 4808000
Obs 59591416
Aggregate (n=5)Sum y = 340Sum y_hat = 333MAE = 13/5 = 2.60MSE = 45/5 = 9.00 | RMSE = 3.00
🎯 1-on-1 Live Mentorship & Free Study Kit

Ace Regression Numericals in Code 843

Solve CBSE Code 843 regression numericals, Python loss functions, and board case studies with 4Achievers Junior (Grades 3-12, 1-on-1 & 1:4 Micro-Pods). Book a free 1:1 practice session.

💬 WhatsApp Now
🔒 Instant WhatsApp notes + free 60-min 1-on-1 trial session
Confirmed! Our Senior Mentor is sending your study kit & free 1-on-1 demo link on WhatsApp now.

6. Common Mistakes & Top Scorer Tips

  • Avoid Mistake: Forgetting to take the square root of MSE when reporting RMSE, leaving the metric in squared units.
  • Avoid Mistake: Summing raw signed errors (y - y_hat) without absolute values or squaring, causing positive and negative errors to cancel out.
  • Avoid Mistake: Using regression error metrics like RMSE on discrete categorical classification outputs instead of Confusion Matrix metrics.
  • Examiner / Mentor Tip: Always compute MSE first and write RMSE = sqrt(MSE) explicitly so examiners see the dependency.
  • Examiner / Mentor Tip: Explain that RMSE > MAE (3.00 > 2.60 here) because larger residuals like 4 receive squared weight 16.
  • Examiner / Mentor Tip: Double-check your arithmetic by verifying that every squared error is non-negative and that RMSE falls between the smallest and largest absolute error.

7. Interactive Concept Check Quiz

Question: Given actual values [10, 20, 30] and predicted values [12, 18, 34], what are the MSE and RMSE?

8. Frequently Asked Questions

Why is RMSE always greater than or equal to MAE on a dataset?
RMSE is always greater than or equal to MAE. They become equal only when every single observation has the exact same error magnitude.
When should a data scientist prefer MAE over RMSE in a real-world project?
Choose MAE when extreme outliers represent noisy anomalies that should not dominate the loss, and choose RMSE when rare large errors are operationally dangerous.
Do RMSE and MAE share the same measurement units as the target variable?
Yes. Both RMSE and MAE measure average prediction error in the exact same units as the target variable y (such as rupees, marks, or degrees Celsius).

Explore Related Lessons & Free Interactive Tools

Free 1-on-1 Session

Book a Free Demo Class