All digital body composition scales are inaccurate; it’s just that some of them are inaccurate in a better way.
What am I talking about? Let’s start from the beginning of the story. This year, I started to take working out very seriously. I train five times per week and do push-ups with one arm. (And sometimes with one leg.)
I am at my peak.
To quantify my progress, I need more than just a simple weight measurement and BMI. I want to track my muscle-fat ratio.
Thus, I decided to get a body composition scale, one that drives a little bit of electrical current through your body and measures how it travels through different types of tissue.
As usual, there are hundreds of smart body composition scales to buy. After watching dozens of reviews, I have realized that almost all of them are inaccurate. However, not all of them are the same. Given two scales, out of which
one is accurate on average, but the measurements are all over the place,
and the other is always off by a constant amount,
which one would you pick?
Hidden between the lines, this dilemma teaches us about an essential concept of statistics: bias and variance.
📌 The Palindrome breaks down advanced math and machine learning concepts with visuals that make everything click.
Join the premium tier to get instant access to guided tracks on graph theory, foundations of mathematics, and neural networks from scratch.
The tale of two scales
First, let’s formulate the measurement problem. Mathematically speaking, we have a
a set of measurements (ŷᵢ, i = 1, …, n),
and a corresponding ground truth (y).
In our example of the body composition scales, ŷᵢ-s are the muscle-fat ratio estimates, while y is the true muscle-fat ratio value. The main problem is to predict y from the ŷᵢ-s.
Here’s a toy example in two dimensions. (Although our example with the body composition scales is one-dimensional, it’s easier to visualize in two dimensions.)
Now comes the exciting part.
First, we model our measurements (ŷ) as the ground truth (y) plus a random error (ε):
That’s the setup; now, we are ready to study bias and variance.
Let’s go back to the beginning and consider the body composition scales. One is consistently off by roughly the same amount, and the other is closer to the true value, with measurements all over the place.
One has high bias, and the other has low variance. But what is bias, and what is variance? Let’s visualize.
Suppose we repeat the same measurements and plot them against the ground truth. Without formulating the definitions of bias and variance, I’ll show you four scenarios:
low bias, low variance,
high bias, low variance,
low bias, high variance,
high bias, high variance.
Can you guess the definitions based on this example? Give it some thought before reading on. Yellow means measurement, blue means ground truth. (Again, it’s for two dimensions because it’s easier to illustrate that way.)
Welcome back! Here we go.
By looking at the figure above, there’s a
systematic error,
and a random noise.
As both the measurement and the error are random variables, it makes sense to analyze them statistically. According to the Oxford Languages Dictionary, bias is
“a systematic distortion of a statistical result,”
which we can quantify via the expected value:
(If you need a refresher on the concept of expected value, check out my earlier post.)
By removing the bias, the error term can be further decomposed! Check it out:
This way, we can decompose the measurement into three terms:
the ground truth (y)
the bias (𝔼[ε])
and the noise (y - 𝔼[ε]).
Due to its definition, the noise has zero mean. Thus, we can characterize it by its variance
quantifying how large the noise is.
Look at this figure below. Again, it’s easier to see for yourself. Bias measures the systematic error, while variance measures the level of noise.
📌 Struggling to learn math and machine learning on your own?
The Palindrome makes complex ideas click — with visual explainers, step-by-step guides, and clear learning paths.
Join the premium tier to finally understand graph theory, neural networks, and the foundations of mathematics in a structured way.
The bias-variance tradeoff
Not so surprisingly, there is an intimate connection between bias and variance two. Let’s elaborate.
First, we’ll look into quantifying the quality of our measurements.
When the ground truth is available, the simplest method is to compute the average of the squared distance between the measurements (ŷᵢ) and the ground truth (y), giving rise to the famous mean-squared error (MSE):
(The square is needed to get rid of the sign of the error. Think about it: if, say, your measurements are off by 1 and -1, the average would be zero without taking the squares.)
In the general case, if the measurements are vectors, we take the average of the squared Euclidean norms:
It’s also easier to illustrate MSE in higher dimensions. Imagine drawing a line from y to each ŷᵢ. The length of this line is ||ŷᵢ - y||, which we square and average. Something like this:
What’s not immediately obvious is that the mean-squared error is an expected value in disguise:
Now, we are ready for the punchline: the mean-squared error can be written in terms of bias and variance:
To see how, let’s do some algebra:
This is known as the bias-variance tradeoff. (To be precise, this is a special case.)
Mathematically speaking (like we always do), the bias-variance tradeoff means that if we assume the mean-squared error to be constant, removing bias always adds variance and vice versa.
After all that we’ve learned, which body composition scale would you choose?
In my case, I realized that I was not interested in my actual muscle-fat ratio. I’m interested in trends! If it does not go up, I’m good; an indication that my nutrition and fitness are adequate. If it goes up, I must eat cleaner and work out more.
However, a measurement with high variance can mask or even reverse trends! A high bias cannot.
Thus, I have concluded that paying twice as much for a more precise instrument is not worth it. Minimizing the variance is enough.
(Plot twist: I ended up not purchasing any body composition scale at all. My mind is chaotic, resisting every attempt at organization. No machine learning can help that.)
Careful with one arm pushups. I did them wrong and had to have my elbow reconstructed after a couple sets. Do not roll your shoulder. So dangerous. did not hurt While incurring injury. Major problems after.
P. S. Love your book. Thanks
nice and clear explanation thanks!