Book a call

Book a call

Book a call

All Blogs

Simple Errors, not that simple insights: Understanding MAE, MSE, and R-Squared

FUNDAMENTALS

Surender Singh

Sept 17, 2025

When we build a model to predict the future - whether it's stock prices, weather, or coffee shop customers - our first question is always: "How good is my prediction?" 


Answering that question requires metrics. Mean Absolute Error (MAE), Mean Squared Error (MSE), and the R-Squared (R²) score are three of the most common and powerful tools for the job.

Let's explore them through a single, practical story: helping a local coffee shop predict its daily customer traffic.

Let's explore them through a single, practical story: helping a local coffee shop predict its daily customer traffic.

The First Prediction and the Problem with Simple Errors

Imagine you're helping "The Daily Grind," a local coffee shop, better manage its staffing and inventory. Your first task is to build a simple model to predict how many customers will visit each day.

You start with the most basic strategy imaginable: your prediction for today is the actual number of customers from yesterday.

Here’s how your first week looks:

The First Prediction and the Problem with Simple Errors

Imagine you're helping "The Daily Grind," a local coffee shop, better manage its staffing and inventory. Your first task is to build a simple model to predict how many customers will visit each day.

You start with the most basic strategy imaginable: your prediction for today is the actual number of customers from yesterday.

Here’s how your first week looks:

  • Monday

    • Actual Customers: 50

    • Your Prediction (Yesterday's Actual): (No previous data)

  • Tuesday

    • Actual Customers: 60

    • Your Prediction (Yesterday's Actual): 50

  • Wednesday

    • Actual Customers: 55

    • Your Prediction (Yesterday's Actual): 60

  • Thursday

    • Actual Customers: 75

    • Your Prediction (Yesterday's Actual): 55

  • Friday

    • Actual Customers: 60

    • Your Prediction (Yesterday's Actual): 75

To see how well you did, you calculate the "error" for each day (Error = Actual - Predicted).


  • Tuesday's Error: 60 - 50 = +10 (You under-predicted by 10)

  • Wednesday's Error: 55 - 60 = -5 (You over-predicted by 5)

  • Thursday's Error: 75 - 55 = +20 (You under-predicted by 20)

  • Friday's Error: 60 - 75 = -15 (You over-predicted by 15)


Now, if you try to find the average error, you run into a problem: (10 - 5 + 20 - 15) / 4 = 10 / 4 = 2.5


An average error of 2.5 seems low, but it's misleading. The positive and negative errors are partially canceling each other out, hiding the true magnitude of your misses. We need a better way.

Mean Absolute Error (MAE): The Honest Average Miss


To fix the cancellation problem, we need to measure the size of the error, regardless of its direction. We do this by taking the absolute value of each error. This value represents the 'distance' between the prediction and the truth.

To see how well you did, you calculate the "error" for each day (Error = Actual - Predicted).


  • Tuesday's Error: 60 - 50 = +10 (You under-predicted by 10)

  • Wednesday's Error: 55 - 60 = -5 (You over-predicted by 5)

  • Thursday's Error: 75 - 55 = +20 (You under-predicted by 20)

  • Friday's Error: 60 - 75 = -15 (You over-predicted by 15)


Now, if you try to find the average error, you run into a problem: (10 - 5 + 20 - 15) / 4 = 10 / 4 = 2.5


An average error of 2.5 seems low, but it's misleading. The positive and negative errors are partially canceling each other out, hiding the true magnitude of your misses. We need a better way.

Mean Absolute Error (MAE): The Honest Average Miss


To fix the cancellation problem, we need to measure the size of the error, regardless of its direction. We do this by taking the absolute value of each error. This value represents the 'distance' between the prediction and the truth.

  • Tuesday

    • Error: +10

    • Absolute Error: 10

  • Wednesday

    • Error: -5

    • Absolute Error: 5

  • Thursday

    • Error: +20

    • Absolute Error: 20

  • Friday

    • Error: -15

    • Absolute Error: 15

Now, we calculate the Mean Absolute Error (MAE) by averaging these absolute values.


MAE = (10 + 5 + 20 + 15) / 4 = 50 / 4 = 12.5


This number is clear and incredibly useful. It tells us: "On average, our model's prediction is off by 12.5 customers."


MAE is a straightforward, honest metric of your average error size, expressed in the original units (in this case, "customers").

Mean Squared Error (MSE): Penalizing Big Mistakes


Your MAE of 12.5 is a good start. But one day, a local festival happens nearby, and the shop is slammed.

Mean Squared Error (MSE): Penalizing Big Mistakes


Your MAE of 12.5 is a good start. But one day, a local festival happens nearby, and the shop is slammed.

Day: Saturday

Actual Customers: 150

Your Prediction: 60

Error: +90

Absolute Error: 90

This is a huge miss! An error of 90 is a big deal - it means running out of coffee, pastries, and having an overworked staff. While MAE would include this error in its average, some situations call for a metric that punishes large, costly errors more severely.


This is where Mean Squared Error (MSE) comes in.

To solve the positive/negative issue and heavily penalize outliers, MSE squares each error before averaging. Think of each error as the side of a "Mistake Square."


  1. The "Square": We take the error from each prediction and square it.

    • Tuesday's Error: 10² = 100

    • Wednesday's Error: -5² = 25

    • Thursday's Error: 20² = 400

    • Friday's Error: -15² = 225

    • Saturday's Outlier: 90² = 8100


  2. Notice two things: negatives vanish, and the huge error of 90 creates an astronomically large "Mistake Square" (8100) compared to the others. MSE treats this outlier as a much bigger deal than MAE does.


  3. The "Mean": We find the average (the "Mean") of these squared values. MSE = (100 + 25 + 400 + 225 + 8100) / 5 = 8850 / 5 = 1770


The MSE score of 1770 is not intuitive in its original units (it's in "customers squared"), but its magnitude sends a clear signal: our model produced at least one very bad prediction.


If your goal is to build a reliable model that avoids catastrophic failures, minimizing MSE is a great strategy.

R-Squared (R²): How Good is the Model, Really?


So far, our metrics tell us the magnitude of our error. An MAE of 12.5 or an MSE of 1770 are just numbers. Are they good or bad? To know, we need to compare our model to something else.


What's the most basic, "no-information" guess we could possibly make?


It would be to simply guess the average number of customers every single day, regardless of any other information. Let's say the average for our dataset is 80 customers.


This "average guess" is our baseline or "naive" model. It has its own error, which represents the total variation in the data.


R-squared answers the question:


By using our prediction model, what percentage of the total original variation did we successfully explain away?


Imagine the total variation (the error from just guessing the average) is a big pie. The error that our model still has is the small slice of the pie that's left over. R² is the portion of the pie our model successfully "ate."


  • An R² of 1.0 is a perfect model. It means our predictions match the actual values perfectly, explaining 100% of the variation.


  • An R² of 0.0 means our model is no better than just guessing the average every time. Our prediction line is useless.


  • An R² of 0.75 means our model has explained 75% of the total variability in customer traffic. The remaining 25% is due to factors our model isn't capturing yet (like weather, holidays, or that surprise festival).

Why Accuracy Alone Can Mislead

Let’s say you’re building a model to detect rare diseases. If only 1 out of 100 people has the disease, a model that always predicts healthy will be 99% accurate. Sounds impressive - but the model never actually detects the disease. This shows why we can’t rely only on accuracy.


Let’s take another example :


Imagine you are designing a model to detect defective lightbulbs in a factory.

Why Accuracy Alone Can Mislead


Let’s say you’re building a model to detect rare diseases. If only 1 out of 100 people has the disease, a model that always predicts healthy will be 99% accurate. Sounds impressive - but the model never actually detects the disease. This shows why we can’t rely only on accuracy.


Let’s take another example :


Imagine you are designing a model to detect defective lightbulbs in a factory.

Why Accuracy Alone Can Mislead


Let’s say you’re building a model to detect rare diseases. If only 1 out of 100 people has the disease, a model that always predicts healthy will be 99% accurate. Sounds impressive - but the model never actually detects the disease. This shows why we can’t rely only on accuracy.


Let’s take another example :


Imagine you are designing a model to detect defective lightbulbs in a factory.

R² provides crucial context. It doesn't tell you the average error in "customers," but it tells you how much explanatory power your model has.

R² provides crucial context. It doesn't tell you the average error in "customers," but it tells you how much explanatory power your model has.

Summary: Choosing the Right Metric

Summary: Choosing the Right Metric


  • MAE (Mean Absolute Error)

    • What it tells you: "What is my average miss?"

    • Best for...: Getting a simple, honest idea of your typical error.


  • RMSE (Root Mean Squared Error)

    • What it tells you: "How bad are my biggest mistakes?"

    • Best for...: Situations where big errors are a disaster and need to be punished.

  • R2 (R-squared)

    • What it tells you: "How much better is my model than a simple guess?"

    • Best for...: Understanding the overall quality and usefulness of your model on a 0-100% scale.

North Beach,

San Francisco, CA

Email:

founders@trainloop.ai

© 2025 TrainLoop. All rights reserved.

North Beach,

San Francisco, CA

Email:

founders@trainloop.ai

© 2025 TrainLoop. All rights reserved.

North Beach,

San Francisco, CA

Email:

founders@trainloop.ai

© 2025 TrainLoop. All rights reserved.