{'fraction_non_alphanumeric': 0.039128812610763924, 'fraction_numerical': 0.008907751142617293, 'mean_word_length': 4.539395505037458, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Distributed Detection via Bayesian Updates and Consensus

In this paper, we discuss a class of distributed detection algorithms which can be viewed as implementations of Bayes' law in distributed settings. Some of the algorithms are proposed in the literature most recently, and others are first developed in this paper. The common feature of these algorithms is that they all combine (i) certain kinds of consensus protocols with (ii) Bayesian updates. They are different mainly in the aspect of the type of consensus protocol and the order of the two operations. After discussing their similarities and differences, we compare these distributed algorithms by numerical examples. We focus on the rate at which these algorithms detect the underlying true state of an object. We find that (a) The algorithms with consensus via geometric average is more efficient than that via arithmetic average; (b) The order of consensus aggregation and Bayesian update does not apparently influence the performance of the algorithms; (c) The existence of communication delay dramatically slows down the rate of convergence; (d) More communication between agents with different signal structures improves the rate of convergence.


Introduction
Recent years have witnessed a considerable amount of work on analysis of networked systems ranging from social and economic networks to robot and sensor networks [1][2][3][4]. An amazing phenomenon arising in networked systems is that, by communicating and cooperating among individuals, the whole group could complete very complicated tasks way beyond the ability of any single agent.
A common task in networked systems is that all agents are supposed to collectively find out an underlying true state of an object using relatively local information such as private observations and neighbors' information. For instance, voters attempt to find out the ability of some political candidates; costumers learn the quality of a new product; a network of sensors detect the mean temperature of a wide area. According to their specific contexts, this task might have different names, such as social learning, distributed detection, distributed estimation, and distributed hypothesis testing [5][6][7][8][9][10][11]. To be consistent, we call this task distributed detection throughout this paper. The aim of the whole group is to detect the underlying true state of an object. To complete the task, a variety of distributed algorithms are designed in the literature to effectively aggregate information scattered all over the network.
In this paper, we focus on a class of distributed detection algorithms which involve the implementation of Bayes' law in a distributed setting. It is well known that the standard Bayes' law is vary useful in detection, estimation, hypothesis testing, and other similar applications. By continuously observing new data or other useful information, an individual could eventually learn the true state. In a networked setting, it is a common phenomenon that any single agent could not learn the true state by itself. However, communicating with others in the network might bring the agents more useful information, and under certain conditions, all agents might eventually learn the true state collectively.
Our work in this paper is directly motivated by [8,[11][12][13] where different but quite similar distributed detection algorithms are developed. All of these algorithms combine certain kinds of consensus protocols with Bayesian updates. They are different mainly in the aspect of the type of consensus protocol and the order of the two operations. In [12], agents first aggregate their neighbors' beliefs, and then update their own beliefs using Bayes' law. It is shown that, under some mild conditions such as the time-varying communication network being jointly strongly connected and initial beliefs on the true state being non-zero, all agents will eventually learn the true state. In [11], in contrast to that in [12], an distributed detection algorithm with local Bayesian update first is proposed. Under more stringent conditions such as a fixed strongly connected network and non-zero initial beliefs on all possible states, it is shown the belief of any agent on any false state converges to zero, and the rate of convergence is related to the network structure. In [13], each agent first compute its Bayesian posterior belief based on its private observation, and then linearly combine it with neighbors' prior beliefs which can be interpreted as communication delay in the dynamics. The distributed detection rule in [8], also involving delayed communication, logarithmically combines the Bayesian posterior based on private observation and neighbors' prior beliefs, which is can be viewed as a logarithmic analog of the rule in [13].
In this paper, we first provide a systemic discussion about the class of distributed detection algorithms which combine certain kinds of consensus protocols with Bayesian updates, and show their essential similarities and differences. Some of the algorithms are proposed in the literature most recently, and others are first proposed in this paper. Then, we provide numerical examples to compare their performance in distributed detection problems. Some qualitative results are given which might provide us insight into the design of more efficient distributed detection algorithms. This paper is organized as follows. In Section 2 we discuss and compare the distributed detection algorithms. In Section 3 we provide numerical examples to analyze the factors which influence the efficient of distributed detection algorithms. Concluding remarks are given in Section 4.

Preliminaries
Consider a social network as a directed graph G = (V, E), where V = {1, 2, · · · , n} is the node set and E ⊂ V × V is the edge set. Each node in V represents an agent, and the edge from i to j, denoted by the order pair (i, j) ∈ E , captures the fact that agent i is a neighbor of agent j, and j can receive some information from i. The set of neighbors of agent i is denoted by N i = {j ∈ V : (j, i) ∈ E}. Moreover, weight a ij ∈ [0, 1] is assigned to any ordered pair of agents such that a ij > 0 if and only if j ∈ N i . The weight a ii ≥ 0 is the self-weight of agent i, and we posit that n i=1 a ij = 1. Let θ denote a state of the object we are concerned with, and all the possible states compose a state set Θ = [θ 1 , θ 2 , · · · , θ m ], in which the true state is denoted by θ * . From the point of view of agent i at time t, the probability of state θ being true is denoted by µ i,t (θ), which is called the belief of agent i on θ. Thus, agent i's belief µ i,t = [µ i,t (θ 1 ), µ i,t (θ 2 ), · · · , µ i,t (θ m )] ∈ P(Θ) is a probability distribution over Θ, where P(Θ) is the set of all possible probability distribution over Θ.
Conditional on the underlying true state, at each time period t > 0, a signal vector s t = (s 1,t , s 2,t , · · · , s n,t ) ∈ S is generated according to the likelihood function ℓ(s t |θ * ), where s i,t is the signal observed by agent i and S is the signal space. For each observed signal s and each possible state θ, agent i holds a corresponding private signal structure ℓ i (s|θ) > 0, representing the probability that it beliefs signal s appears if the true state is θ. We assume that the private signal structure of agent i about the true state θ * is the i-th marginal of ℓ(·|θ * ), which means the agent has a perfect prior information about the true state. If there exists a stateθ = θ * satisfying that ℓ i (s|θ) = ℓ i (s|θ * ) for all signal s, we callθ observationally equivalent to the true state. That is to say, stateθ and the underlying true state θ * arouse exactly the same signals according to the same probability in agent i's eyes, and thus, he cannot tell these two state apart only by observing the signals. All the states that observationally equivalent to θ * from the point of view of agent i compose a setΘ i = {θ ∈ Θ : ℓ i (s|θ) = ℓ i (s|θ * ), ∀ s ∈ S}. If ∩ n i=1Θ i = {θ * }, we say the true state θ * is globally identifiable.
In the next, we will describe six distributed detection algorithms which all can be viewed as combinations of consensus protocols and Bayesian updates.

Interpret the Bayesian Posterior as the Solution of an
Optimization Problem The standard Bayesian posterior obtain by agent i based on its observation s i,t+1 is as follows: As point out in [12,14,15], the posterior belief can be interpreted as the solution of the following optimization problem where D KL (π µ i,t ) is the Kullback-Leibler divergence (the KL-divergence for short) between probability distributions π and µ i,t with the following definition Note that the first term on the right hand side of (2) measures the difference between the distributions π and µ i,k , and the second term is the maximum likelihood estimation given the observation s i,t+1 . Thus, the posterior distribution can be viewed as a tradeoff between the prior belief and the observation.
In a network setting, by introducing neighbors' prior distribution into the optimization problem (2), we obtain the following new optimization problem which is the KL-divergence between π and the geometric mean of the prior beliefs of agent i and its neighbors. By the above derivation, the optimization problem (3) can be rewritten as The solution of (3) (also (4)), is the Bayesian posterior belief corresponding to the prior n j=1 µ aij j,t , which has the following form The updating rule (5) is a distributed algorithm whereby each agent first aggregates the beliefs of its neighbors and itself as a new prior belief via weighted geometric average, and then uses Bayes' law to compute posterior distribution. For simplicity, in this paper we call the rule (5) LoAB (Logarithmic Aggregation and Bayesian update). The rule LoAB has been originally proposed and studied by Nedić et al. in [12], and the sufficient condition under which agents can learn the underlying true state using (5) is summarized as follows: Condition 1: there is an integer B ≥ 1 such that the network is jointly strongly connected across every B time slots. (2) Any positive weight has a constant lower bound η > 0, i.e., if a ij > 0 then a ij ≥ η for all i, j ∈ V . (3) All agents have positive self-weights, i.e., a ii > 0 for all i ∈ V . (4) All agents have positive initial belief on θ * . (5) The true state θ * is globally identifiable.
In [12], Nedić et al. further consider a more general case where the true state θ * might not be listed as one of the possible states. They define a set of state Ω i for each agent i, where Ω i = arg min θ k ∈Θ D KL (ℓ i (·|θ * )|ℓ i (·|θ k )), and let Ω * ∩ n i=1 Ω i which is not empty. That is to say, even though the true state might not be considered as a possible state, there exist some states which best explain the observations from the point of view of all agents. They prove that under such a relaxed condition, µ i,t (θ) → 0 almost surely as t → ∞ for all i and θ / ∈ Ω * . This implies that if there is only one state in Ω * , all agents eventually assign belief of one on this state which is closest to the true state.
Next we propose an alternative way to introduce neighbors' information into the Bayesian update (2): instead of computing the weighted average of all KL-divergences between π and prior beliefs like that in (3), we can compute the KLdivergence between π and the weighted average of prior be-liefs. The new optimization problem is as follows The solution of (6) is the Bayesian posterior distribution corresponding to the prior n j=1 a ij µ j,t , i.e., for any θ ∈ Θ The essential difference between (5) and (7) is that the former aggregates prior beliefs via geometric average while the latter via arithmetics average. Here we call the algorithm (7) LiAB (Linear Aggregation and Bayesian update).

Aggregation of Bayesian Posterior Distributions
A common feature of the algorithms LiAB and LoAB is that they first aggregate local prior beliefs as a new prior and then use the Bayes' law to compute the posterior distribution. We might change the order of the two steps and obtain two new algorithms.
If we let each agent first updates its belief distribution based on its private observation and then exchanges the posterior distribution with its neighbors via weighted geometric average, we obtain the following algorithm which is called BLoA(Bayesian update and Logarithmic Aggregation) The denominator in (8) is added to ensure that µ i,t+1 is still a well-defined probability distribution over Θ.
The rule (8) has been proposed and extensively studied in [11]. The sufficient condition for detecting the true state is summarized as follows:
(2) All agents have positive initial belief on all θ ∈ Θ.
(3) For every pair θ p = θ q , there is at least one agent i for which the KL-divergence D KL (ℓ i (·|θ p ) ℓ i (·|θ q )) > 0. Compared with Condition 1, the terms in Condition 2 are more stringent. The second term requires that not only the initial beliefs of all agents on the true state are positive, but also beliefs on all other states must be positive. The third term implies that there is no state that is observationally equivalent to any other state from the point of view of all agents in the network, i.e., all states are globally identifiable.
Note that the rule in [11] is not in the form like (8) but in the following form In fact, the rule (10) is identical to (8)  From the above derivation it is not hard to understand why we call rules (5) and (8) logarithmic aggregations, since both of them involve geometric averages which can be written in logarithmic forms like that in (10).
Similar to (8) in the sense of aggregating Bayesian posterior beliefs of neighbors, we can construct another algorithm where the geometric average in (8) is replaced by the arithmetic average, which is called BLiA(Bayesian update and Linear Aggregation) here whereμ j,t+1 (θ) is identical to that in (9).

Aggregation of Personal Bayesian Posterior and Others' Prior
The following two algorithms, like BLoA and BLiA, also contain personal Bayesian update and communication with neighbors. However, agents exchange prior distributions with their neighbors rather than posterior distributions. We may consider that this sort of algorithms introduce communication delay into the dynamics such that agents could not receive their neighbors' latest information (the posteriors) but only delayed information (the priors before Bayesian update).
There are also two ways to aggregate neighbors' information. If the agent aggregate its personal posterior and its neighbors' priors via arithmetic average, we have the following algorithm called BLiAD (Bayesian update and Linear Aggregation of Delayed information) The rule (12) is originally proposed in [13] in the context of social learning. The sufficient condition under which agents can learn the underlying true state using (12) can be summarized as follows:
(2) All agents have strictly positive self-weights, i.e., a ii > 0 for all i ∈ V . (3) There exists at least one agent with positive initial belief on the true state θ * . (4) The true state θ * is globally identifiable.
Replacing the arithmetic average in BLiAD by the geometric average, we obtain another algorithm here called BLoAD (Bayesian update and Logarithmic Aggregation of Delayed information) as follows Similar to (13), in [8] Rad and Tahbaz-Salehi propose a distributed estimation algorithm as follows: where λ i > 0 is the weight that agent i assigns to its private observations and c i,t is a normalization constant, not dependent on θ, which ensures that µ i,t+1 is a well-defined probability distribution over Θ.
The rule (14) is identical to (13) by choosing the following values for the parameters λ i and c i,t : In fact, the rule (14) can be written in the following form: The rule (14) has been theoretically studied in [8], and the sufficient condition for detecting the true state is summarized as follows:
(2) All agents have positive initial prior belief on all θ ∈ Θ.
As a summarization, we provide the classification tree of the six distributed detection algorithms in Fig. 1.

Comparison with the Bayesian Update of a Single
Agent L. J. Savage has pointed out in [16] that, barring two banal exceptions, a single agent becomes almost certain of the true state when the amount of its observation increases infinitely. One exception is that the initial belief of the true state is zero. This is very easy to understand. If the belief is zero, then, no matter what signal is observed, the posterior belief of the true state is still zero. The other exception occurs when there exists a state which arouses exactly the same signals as the true state does, i.e., observationally equivalent state exists.
When an agent is situated in a network setting, the above two requirements might be relaxed. For instance, it has been proven that the rules LoAB, BLoA, BLiAD, and BLoAD only require the true state being globally identifiable. We conjecture that LiAB and BLiA might also work well with the same condition, even though theoretical analyses are not available yet.
It is not hard to see that all rules involving geometric averages, such as LoAB, BLoA, and BLoAD, still need the requirement of non-zero initial belief of all agent on the true state. For the rules BLiAD which contains linear aggregations, it has been proven in [13] that at least one agent with non-zero initial belief on the true state is enough for a correct detection.
For the rules involving delayed information such as BLiAD and BLoAD, the requirement of non-zeros self-weights must be satisfied, at least for part of the agents. Because if all selfweights are zeros, any new observation will be discarded and BLiAD and BLoAD specialize to traditional consensus protocols with arithmetic average and geometric average, respectively.

Numerical Examples
In this section, we exam the effectiveness of each distributed detection rule by numerical examples. Our test platform is a nearest-neighbor coupled network, which might represent a sensor network or a robot network where, restricted by its communication range, each agent can only exchange information with a given number of its closest neighbors. The following Fig. 2 shows a schematic diagram of a nearest-neighbors coupled network of 20 agents, where each agent could only interact with 5 closest agents (including itself) and all of the edges are bi-directed.
In our first simulation, we let agents from V 1 be close to each other, and the same to V 2 , i.e., agents belong to the same set form a cluster. In the second simulation, we mix all agents in the sense that each agent from V 1 is located between two agents from V 2 , and vice versa.
We focus on the number of iterations of update for each algorithm to detect the true state. If for all i ∈ V , |µ i,t (θ 3 )−1| ≤ 10 −3 , we say the whole group collectively detect the true state. The result is shown in Fig. 3, which is the average of 100 realizations. From Fig. 3, we have the following observations: (1) All of the six distributed detection algorithms are effective in detecting the true state. (2) If other aspect are identical, aggregating information via geometric average (i.e., BLoA, BLoAD, and LoAB) is much faster than that via arithmetic average (i.e., BLiA, BLiAD, and LiAB).
(3) Using delayed information in aggregation (i.e., BLiAD and BLoAD) makes the detection much slower. (4) Bayesian update first or aggregating information from neighbors first does not influence the efficiency of detection apparently. (5) Mixing agents with different signal structures promote the rate of detection.
The above items (2) and (3) are in accordance with the theoretical result in [11] where BLoA is compared with BLiAD. One of the main results is that, the lower bound on the rate of

Concluding Remarks
In this paper, we discuss a class of distributed detection algorithms in which personal Bayesian updates are combined with some types of consensus protocols. We focus on six algorithms and classify them according to the type of consensus protocol, the order of Bayesian update and consensus, and whether timedelayed information is involved in the interaction. By comparison, we have a systemic impression of these distributed detection algorithms, which might lead us to establishing more refined conditions under which agents could detect the underlying true state in distributed settings. For instance, could the terms (2) and (3) in Condition 2 be replaced by more relaxed requirements, say the terms (4) and (5) in Condition 2, respectively? And also, could the Conditions 2, 3, and 4 be relaxed to time-varying networks like that in Condition 1? Through numeric examples, we obtain some qualitative results about the efficiency of these distributed algorithms, which might shed light on designing more efficient distributed detection algorithms in the future.
There are many other types of distributed detection algorithms proposed in the literature. For instance, instead of exchanging beliefs, agents can share their signal structures with their neighbors which could also result in a correct detection of the true state [7,9,10]. Also, Bayesian update is not the only choice in detection problem. More alternatives can be found in the the area of distributed detection of multiple sensors in wireless sensor networks [17][18][19].