Regression Evaluation Metrics

Regression Evaluation Metrics are used to measure:

How well a regression model performs

These metrics compare:

  • Actual values

  • Predicted values

and calculate:

Prediction error

Why Evaluation Metrics are Important

After training a regression model:

We must check how accurate the predictions are

Evaluation metrics help us:

  • Measure model performance

  • Compare models

  • Detect errors

  • Improve prediction quality

Example

Suppose:

Actual Price Predicted Price
100 90
200 210
300 280

The model predictions are close, but not perfect.

Evaluation metrics calculate:

How much error exists

Common Regression Evaluation Metrics

Metric Full Form
MAE Mean Absolute Error
MSE Mean Squared Error
RMSE Root Mean Squared Error
R² Score Coefficient of Determination

1. Mean Absolute Error (MAE)

MAE calculates:

Average absolute error

Formula:

MAE = mean(|Actual - Predicted|)

MAE Example

Actual Predicted Error
100 90 10
200 210 10
300 280 20

Calculate MAE

(10 + 10 + 20) / 3
40 / 3
13.33

Final MAE

MAE = 13.33

Lower MAE:

Better model

2. Mean Squared Error (MSE)

MSE calculates:

Average squared error

Formula:

MSE = mean((Actual - Predicted)²)

MSE Example

Actual Predicted Error Error²
100 90 10 100
200 210 -10 100
300 280 20 400

Calculate MSE

(100 + 100 + 400) / 3
600 / 3
200

Final MSE

MSE = 200

Large errors get:

Higher punishment

because errors are squared.

3. Root Mean Squared Error (RMSE)

RMSE is:

Square root of MSE

Formula:

RMSE = √MSE

RMSE Calculation

Suppose:

MSE = 200

Then:

RMSE = √200
RMSE ≈ 14.14

Why RMSE is Useful

RMSE converts:

Squared error back to original units

This makes interpretation easier.

4. R² Score (Coefficient of Determination)

R² Score measures:

How well the model explains the data

Range:

R² Score Meaning
1 Perfect prediction
0 No learning
Negative Very poor model

R² Formula

R² = 1 - (SSR / SST)

Where:

  • SSR → Sum of Squared Residuals

  • SST → Total Sum of Squares

Understanding R²

Suppose:

R² = 0.90

This means:

90% of the variation is explained by the model

Which Metric is Better?

Metric Best Use
MAE Simple average error
MSE Penalizes large errors
RMSE Error in original units
Overall model performance

Important Understanding

Lower values are better for:

  • MAE

  • MSE

  • RMSE

Higher values are better for:

  • R² Score

Practical Example Using Python

Step 1: Import Libraries

from sklearn.metrics import (
mean_absolute_error,
mean_squared_error,
r2_score
)

import numpy as np

Step 2: Actual and Predicted Values

actual = np.array([100, 200, 300])

predicted = np.array([90, 210, 280])

Step 3: Calculate MAE

mae = mean_absolute_error(actual, predicted)

print("MAE:", mae)

Step 4: Calculate MSE

mse = mean_squared_error(actual, predicted)

print("MSE:", mse)

Step 5: Calculate RMSE

rmse = np.sqrt(mse)

print("RMSE:", rmse)

Step 6: Calculate R² Score

r2 = r2_score(actual, predicted)

print("R² Score:", r2)

Example Output

MAE: 13.33

MSE: 200

RMSE: 14.14

R² Score: 0.97

Advantages of Evaluation Metrics

  • Measure prediction quality

  • Compare multiple models

  • Detect poor models

  • Improve model selection

Real-World Applications

Industry Usage
Finance Stock prediction accuracy
Healthcare Disease prediction evaluation
Real Estate House price prediction quality
Sales Revenue forecasting accuracy

Important Points

1. MAE measures average absolute error.

2. MSE squares errors and penalizes large mistakes.

3. RMSE converts squared error into original units.

4. R² Score measures goodness of fit.

5. Lower error metrics indicate better performance.

Summary

Regression Evaluation Metrics help measure the accuracy and quality of regression models. Metrics such as MAE, MSE, RMSE, and R² Score compare predicted values with actual values and help determine how well the model performs on unseen data.

Keywords

Regression Evaluation Metrics, MAE, MSE, RMSE, R2 Score, Regression Accuracy, Mean Absolute Error, Mean Squared Error, Root Mean Squared Error, Coefficient of Determination, Model Evaluation, Regression Performance Metrics, Machine Learning Metrics, Regression Error Calculation, Evaluation Metrics in Machine Learning

Previous Topic Random Forest Regression Next Topic CART : Example