# Using Bayesian Networks to solve this localization problem?

I'm reading this paper, which I'll summarize here:

Let a sensor network (in this case, a network of radio receivers) consist of $$N$$ sensor nodes at locations $$S = \{ S_1 \cdots S_N\}$$. Let $$S_i^x$$ refer to the $$x$$-coordinate of the location of sensor node $$i$$, and $$S_i^y$$ refer to the $$y$$-coordinate. We assume locations in $$2$$-D space, but the same technique will work in $$3$$-D space as well.

These locations are not known to us.

Second, let there be $$M$$ radio-generating events at locations $$E = \{ E_1 \cdots E_M\}$$. Moreover, let $$E_i^x$$ and $$E_i^y$$ refer to the respective coordinates.

These locations are not known to us.

Finally, let the times of the radio-generating events (the "time of emission") be $$T = \{ T_1 \cdots T_M \}$$.

These times are not known to us.

Goal: to determine the coordinates ($$E_i^x$$, $$E_i^y$$) of each radio-generating event.

Let there exist up to $$M\cdot N$$ variables $$R_n^m$$ that specify the time recorded at sensor node $$S_m$$ for sound $$E_n$$. We assume that $$R_n^m$$ is distributed as follows:

$$R_n^m \approx N(T_n + \frac{d(S_m,E_n)}{c},\sigma)$$

$$d(S_m, E_n) = \sqrt{(S_m^x - E_n^x)^2 + (S_m^y - E_n^y)^2}$$

Where $$c$$ is the speed of light, $$\sigma$$ is the standard deviation of the error in recording times, and $$N(\mu,\sigma)$$ is a Normal distribution with mean $$\mu$$ and standard deviation $$\sigma$$.

We encapsulate the relations between variables as Bayesian network, and show how the localization problem reduces to that of maximum likelihood estimation in this Bayesian network.

In the Bayesian network, there will exist a variable of the form $$R_n^m$$ whenever sensor node $$n$$ "hears" signal $$m$$. These recorded times are stochastically determined by sensor node locations, signal emission locations, and emission times, as above. Thus, the conditional probability is:

$$P(R_n^m | S_n,E_m,T_m) = \frac{1}{\sqrt{(2\pi)}\sigma} \cdot \exp{( \frac{-(T_j + d(S_i,E_j)/c - R_j^i)^2}{2\cdot\sigma^2} )}$$

Since there is no global reference frame, we impose the following arbitrary conditions to regularize our solution. $$S_1$$ is the set to be $$(0,0)$$. $$S_2$$ is set to lie on the positive $$x$$-axis. $$S_3$$ is the set to lie above the $$x$$-axis.

Let $$L(R | S,E,T)$$ be the likelihood of the data given the model in the Bayesian network. This likelihood is simply the product of each of the conditional probabilities.

Expanding the likelihood, we obtain:

$$L(R|S,E,T) = \prod_{m,n} P(R_n^m | S_m,E_n,T_n)$$

Since a scalar multiple of the log-likelihood is monotonic in the likelihood, we can take the log of Equation (5) and multiply by $$2\cdot \sigma^2$$ to obtain:

$$l = \sum_{m,n} -(T_n + \frac{d(S_m,E_n)}{c} - R_n^m)^2$$

We use gradient descent with both line search and momentum to maximize $$l$$. Due to the monotonicity of $$l$$ with the likelihood, this process effectively finds the maximum likelihood estimate of the sensor node locations given the model parameters.

I'm looking to apply this technique, in practice and algorithmically (i.e., in code) to determine the location of one signal source, given four receivers. Unfortunately, however, I haven't done anything with Bayesian networks for some time (and what I have done is minimal), and I'm not quite following everything here.

I follow up to the line $$P(R_n^m | S_n,E_m,T_m)$$. I don't quite understand what's going on afterwards? It also isn't entirely clear to me precisely how this would be "generalized" to a 3-dimensional solution.

What's going on here, and how to use it in practice?