Embedded Naive Bayespost by johnswentworth · 2019-08-22T21:40:05.972Z · LW · GW · 6 comments
Suppose we have a bunch of earthquake sensors spread over an area. They are not perfectly reliable (in terms of either false positives or false negatives), but some are more reliable than others. How can we aggregate the sensor data to detect earthquakes?
A “naive” seismologist without any statistics background might try assigning different numerical scores to each sensor, roughly indicating how reliable their positive and negative results are, just based on the seismologist’s intuition. Sensor i gets a score when it’s going off, and when it’s not. Then, the seismologist can add up the scores for all sensors going off at a given time, plus the scores for sensors not going off, to get an aggregate “earthquake score”. Assuming the seismologist has decent intuitions for the sensors, this will probably work just fine.
It turns out that this procedure is equivalent to a Naive Bayes model.
Naive Bayes is a causal model [LW · GW] in which there is some parameter in the environment which we want to know about - i.e. whether or not there’s an earthquake happening. We can’t observe directly, but we can measure it indirectly via some data - i.e. outputs from the earthquake sensors. The measurements may not be perfectly accurate, but their failures are at least independent - one sensor isn’t any more or less likely to be wrong when another sensor is wrong.
We can represent this picture with a causal diagram:
From the diagram, we can read off the model’s equation: . We’re interested mainly in the posterior probability or, in log odds form,
Stare at that equation, and it’s not hard to see how the seismologist’s procedure turns into a Naive Bayes model: the seismologist’s intuitive scores for each sensor correspond to the “evidence” from the sensor . The “earthquake score” then corresponds to the posterior log odds of an earthquake. The seismologist has unwittingly adopted a statistical model. Note that this is still true regardless of whether the scores used are well-calibrated or whether the assumptions of the model hold - the seismologist is implicitly using this model, and whether the model is correct is an entirely separate question.
The Embedded Naive Bayes Equation
Let’s formalize this a bit.
We have some system which takes in data , computes some stuff, and spits out some . We want to know whether a Naive Bayes model is embedded in . Conceptually, we imagine that parameterizes a probability distribution over some unobserved parameter - we’ll write , where the “;” is read as “parameterized by”. For instance, we could imagine a normal distribution over , in which case might be the mean and variance (or any encoding thereof) computed from our input data. In our earthquake example, is a binary variable, so is just some encoding of the probability that .
Now let’s write the actual equation defining an embedded Naive Bayes model. We assert that is the same as under the model, i.e.
We can transform to log odds form to get rid of the Z:
Let’s pause for a moment and go through that equation. We know the function , and we want the equation to hold for all values of . is some hypothetical thing out in the environment - we don’t know what it corresponds to, we just hypothesize that the system is modelling something it can’t directly observe. As with , we want the equation to hold for all values of . The unknowns in the equation are the probability functions , and . To make it clear what’s going on, let’s remove the probability notation for a moment, and just use functions and , with written as a subscript:
This is a functional equation: for each value of , we want to find functions , , and a constant such that the equation holds for all possible values. The solutions and can then be decoded to give our probability functions and , while can be decoded to give our prior . Each possible -value corresponds to a different set of solutions , , .
This particular functional equation is a variant of Pexider’s equation; you can read all about it in Aczel’s Functional Equations and Their Applications, chapter 3. For our purposes, the most important point is: depending on the function , the equation may or may not have a solution. In other words, there is a meaningful sense in which some functions do embed a Naive Bayes model, and others do not. Our seismologist’s procedure does embed a Naive Bayes model: let be the identity function, be zero, and , and we have a solution to the embedding equation with given by our seismologist’s add-all-the-scores calculation (although this is not the only solution). On the other hand, a procedure computing for real-valued inputs , , would not embed a Naive Bayes model: with this , the embedding equation would not have any solutions.
Comments sorted by top scores.