A puzzle of two unreliable sensors

https://news.ycombinator.com/rss Hits: 3
Summary

Suppose you are trying to measure a value P and you have two unreliable sensors. Sensor A returns 0.5P + 0.5U, where U is uniform random noise over the same domain as P. Sensor B will return either P or U with 50% likelihood. In other words, sensor A is a noisy measurement of your variable, and B is sometimes the correct value and sometimes pure noise. If we have the readings of both sensor A and sensor B, what can we say about P? Let’s make a graph to give us some intuition. Given 100 samples of P taken uniformly from [0, 1), this shows the relative error of sensor A vs. the relative error of sensor B. As we would expect, errorA is 0 half the time. The rest of the time, it can range from -1 to 1; errorB is rarely exactly 0, but its range is half that of errorA. Let’s look at some numerical summary stats for errorA, errorB, and the error of the average of A and B over 100k trials. The mean error of the average of A and B seems a bit lower than the error of either A or B on its own. But wait! The choice to give equal weight to sensor A and sensor B seems a bit arbitrary. Let’s explore the different weights numerically, considering each weighting of A and B in increments of 0.1. Here the x-axis gives us the weight w we assign to sensor A, while sensor B is assigned weight 1 – w. The y-axis shows the average value of the absolute error of this combination over 100k simulations. As you can see, the best weight is not 50-50, but around 0.58, where our mean error drops to around 0.1524. We could theoretically improve the precision of this estimate with a ternary search, but in practice numerical accuracy becomes a problem and I can’t nail it down much tighter than 0.586 or so. (I’m sure there’s some nice technique for this that’s eluding me at the moment.) So that’s interesting. What’s the theoretical grounding for this mixture of variables, and can we do better than a linear mixture? Well, for one thing, it would be really great to know when sensorB is returning the corr...

First seen: 2025-04-16 09:16

Last seen: 2025-04-19 09:20