The Distributed Convergence Classifier Using the Finite Difference

. The paper presents a novel distributed classifier of the convergence, which allows to detect the convergence/the divergence of a distributed converging algo-rithm. Since this classifier is supposed to be primarily applied in wireless sensor networks, its proposal makes provision for the character of these networks. The classifier is based on the mechanism of comparison of the forward finite differences from two consequent iterations. The convergence/the divergence is classifiable only in terms of the changes of the inner states of a particular node and therefore, no message redundancy is required for its proper functionality


Introduction
The distributed detection of a global event is considered to be an important aspect within wireless sensor networks (labeled as WSNs).According to [1], there are three classes of distributed detection architectures.The first class is based on transmitting messages to a fusion center, where the final decision regarding the underlying phenomena is made.In the second class, the presence of a fusion center is not assumed.The functionality is divided into two phases: a data collection and a consensus algorithm to achieve the respective decision.Within the third class, the sensing and the communication occur simultaneously.Just like in the second case, also, this class does not assume the presence of a fusion center.In this paper, we focused on a detection of a proper functionality of converging algorithms, where several consensus algorithms belong.The consensus algorithms are used as a supportive complement within wireless sensor networks.As mentioned in [1], the classes that do not assume the presence of a fusion center usually require an implementation of such an algorithm.In contrast to the related latest works, where the authors are focused on various scenarios such as the detection of a corrupted node, the detection of an abnormality, a prevention of false alarms and an increase of the lifetime of a network etc., our paper presents the novel fully-distributed classifier intended to examine a proper functionality of a converging algorithm.In this paper, our attention is primarily focused on the average consensus algorithm, which requires an initial configuration.However, a correct configuration poses a difficult challenge especially in large-scale networks due to the distributed character of WSNs.Incorrect settings can either significantly decelerate the whole process or even prevent the algorithm from working correctly -it may cause the algorithm to diverge.
The divergence is a critical system failure that paralyzes the whole functionality of a system executing a distributed converging algorithm.Since the execution of a distributed algorithm is an unstable process due to limited information about the other elements in a system, it would be very appropriate to implement a simple fully distributed mechanism to track the proper functionality.This paper was motivated by a lack of papers dealing with the proposal of an effective mechanism to detect this type of a failure.We present a novel fully distributed classifier whose principle is based on utilizing the features of the converging algorithms.It utilizes the finite difference to detect whether a network converges or diverges.We assume the implementation of this algorithm into WSNs and therefore, we made provision for the character of these networks.

Wireless Sensor Networks
WSNs are usually formed by a group of small, battery-powered and wirelessly connected nodes [2].The particular nodes communicate together in order to fulfill a specific functionality.Each node is characterized by a limited communication range because of cost and resource constrains [2].Thanks to their character, WSNs find the usage in various fields of application such as industrial monitoring, farming and agriculture, structural monitoring, health assistance, location and guiding, security and defense etc. [3].Due to the character of WSNs, these networks are classified as distributed systems, where particular elements are only limitedly aware of the other elements in a network as well as the network as the whole.Accord-ing to [4], a crucial challenge within the design of WSNs is to meet varying application requirements.The nodes are often deployed in inaccessible zones, which makes the WSNs more susceptible to failures compared with other systems.The mentioned complication results in the fact that manual inspection of the particular nodes is considered to be an impractical and inappropriate solution of a potential failure.Thus, the WSN nodes are characterized by a significantly higher fault rates in comparison with the devices used within other semiconductor-based systems [4].Especially it is for distinctive features such as [5] resource constraints, lack of well-defined models, network dynamics etc.The listed facts are reasons of why the mechanisms to detect failures within these systems significantly differ from the traditional systems [6].

The Graph Theory
A set of the mathematical tools well-known from the graph theory has been applied in order to describe WSNs.These networks are classified as distributed systems, which are describable using a graph defined as follows: The graph G is determined by two sets: the set of all the vertexes V and the set of all the edges E. The set V is formed by all the vertexes, which represent particular nodes within WSNs [7][8][9][10].The set E⊂VV contains all the edges, whose existence indicates a direct connection between two nodes.This connection is called a path.The vertexes are described by the unique identity number, which also determines the initial value of a node within our experiments.We consider homogeneous graphs, i.e. the features of all the nodes are equivalent to each other; therefore, the following sentence is valid: (2)

Average Consensus Algorithm
For our analysis, we have chosen average consensus algorithm.It is a distributed converging algorithm whose purpose is that each node in a WSN converges to the value counted as the average from all the initial values [11].Thanks to its simplicity, it is widely implemented into WSNs [12].The consensus is reached in an iterative manner, i.e. node updates its inner value in terms of the inner value from the previous state as well as the values from the adjacent nodes.Let us define the vector: x(k) ∈ R N  1 is the vector containing the values of all the nodes at the kth iteration.The value of a particular node is affected by the inner state from the previous iterations and the values from the adjacent nodes and therefore: The matrix W ∈ R N  N describes the features of a network, i.e. it describes the relative connectivity of two particular nodes.The parameter N presents the number of the nodes in a network; therefore, its size.Within our analysis, we assume a constant weight model, which is defined as follows [13]: Here, the parameter  determines the rate of the algorithm as well as the interval of the convergence.The parameter d is the degree of a node; therefore, the number of its neighbors.
The average consensus algorithm can be defined as a difference equation as follows: There is also a less general expression defined as follows: Since the average consensus algorithm is a converging algorithm, its behavior is described as follows [14]: Here, the vector J is all-ones vector [15].The existence of the limit (8) depends on the parameter .Its higher value ensures a higher computation rate, however, it might cause the divergence of the algorithm.The interval in which the algorithm converges is determined as follows [11], [13]: Since WSNs are distributed systems, where particular elements are only very limitedly aware of the other elements in a network as well as the network as the whole and therefore, assessing a value of  for which the algorithm converges is a difficult task for nodes.Thus, a fully distributed mechanism to classify whether the algorithm converges or diverges would be a useful tool that could improve the performance and also prevent a network from a failure.
Let k l be the label of the last iteration of the whole process.Due to (8), the convergence event has to be defined in order to indicate the consensus in a network.We used the one defined as follows: We assumed that δ equals 0.00015, which ensures a high precision of the computation process.

Related Works and Comparison with Our Method
In this section, our attention is focused on the algorithms for a fault detection within WSNs.Primarily, we are focused on the modern solutions within this area, but also a brief overview of older solutions is provided as well.Afterward, our method is compared with the latest works.
In [16], the authors introduce Agnostic Diagnosis (AD) -a mechanism exploiting certain correlation patterns usually exhibited by the system metrics.Subsequently, violations of these patterns indicate a potential failure.The proposed scheme requires the presence of a base station that gathers the information about the nodes in a network.However, this fact results in significant energy demands on a base station and the nodes situated in its adjacent area.In spite of the mentioned disadvantages, the mechanism is considered to be a high-quality solution because it achieves the precision close to 100% (at least in networks with a small size).The goal of this mechanism is to detect socalled silent failures.
The authors of [17] present a fault detection method based on the Naïve Bayes framework.It is a probabilistic based fault diagnosis algorithm exploiting increased resource consumption.The authors introduced two concepts: one for the center node and the other for the adjacent nodes.Its purpose is to minimize that the probability of sending a false signal during an event detection or an object tracking.The proposed schemes achieve the precision from 73% to 99%.
The mechanism presented in [18] exploits a genetic algorithm in clustered WSNs.It is based on majority vote, which allows a permanent failure detection of the nodes.The proposed algorithm achieves the precision of fault detection in the range approximately 40%-100%.
The method proposed in [19] is a mechanism for an anomaly detection based on an extension of the continuous wavelet transform (labelled as S-transform) in a combination with SVM (Support Vector Machine).S-transform is used to extract the features from the data set and subsequently, these features are used to train SVM, which is used to classify whether data is normal or anomalous.The proposed mechanism achieves maximally 94% accuracy.
In [20], the authors proposed the spatiotemporal correlation based fault-tolerant event detection scheme (STFTED).It leverages a two-stage decision fusion and a spatiotemporal correlation so that the event detection quality will be enhanced.The low-level stage is executed inside the nodes with a location-based weighted voting scheme (labelled as LWVS).This scheme utilizes the spatiotemporal correlation of the nodes based on neighboring nodes and the geographical distributions of two decision quorums.Then the high-level global stage uses a Bayesian fusion algorithm to reach a consensus among the nodes.It is used to verify a correctness of a sensed quantity and minimize the probability of a false alarm.The method reaches that the normalized number of the nodes detecting event is above 90%, the normalized percentage of new errors introduced is under 20%.The authors of [21] propose a mechanism that finds a primary usage in medicine.It integrates a decision tree and a linear regression for an anomaly detection.First of all, the attributes of a monitored patient are classified as either normal or abnormal.Afterward, the regression prediction is used to discern between a faulty sensor reading and a patient entering into a critical state.The presented results show high accuracy (an incorrect classification occurs in approx.1% of all the tested cases).
The authors of [22] propose Distributed Fault Identification algorithm (DFI) based on a neighbor coordination approach.The algorithm procedure consists of two phases: the partial self-fault identification phase and the self-diagnosis phase.Within the first phase, each node exchanges data with its neighbors and then estimates the probable fault status of both itself and its neighbors.These statuses are exchanged within the other phase.Afterward, each node is sent its probable fault by its neighbors and makes a diffusion of the received status.Then, it compares its calculated state with the diffused one and predicts its own status according to the obtained information.It is proposed to find hard and soft faulty nodes.DFI Algorithm achieves the precision between approximately 96 -100%.
In [23], a distributed, reference-free fault detection algorithm is proposed, which is based on a local pairwise verification executed between the nodes whose goal is to monitor the same quantity.The algorithm is based on a linear relationship between the outputs of a pair of the nodes.This knowledge is utilized to detect faulty nodes.The accuracy of the algorithm achieves around 84%.The false alarm occurred in 0.04%.The authors of [24] proposed model-based Fault-Tolerance for Data Errors (FTDE) scheme.This mechanism is able to correct data errors at the point of the origin i.e. costly transmission of corrupted data is prevented.The proposed scheme poses a lightweight solution in terms of computation, memory and message costs.
The authors of [25] present a Fault-Tolerant and Energy-Aware Mechanism (FTEAM), which prolongs the lifetime of WSNs, primarily proposed for cluster-based WSN protocols.The method is based on the principle of an identification of the overlapped nodes and the configuration of the most powerful nodes to the sleep mode in order to save their energy for the purpose of replacing a failed Cluster Head with them.
In [26] the authors present a modified three-sigma edit test based self-fault diagnosis algorithm whose functionality is based on computing the normalized median absolute deviation of the data from the adjacent area according to which a fault node is classified.Its diagnosis accuracy is 98.313%.The authors of [27] proposed a novel idea of an Active node based Fault Tolerance using Battery power and Interference model (AFTBI).It is executed in such a way that a node whose battery source is low sends all its services to the node whose battery power is the highest within the adjacent area.The low-energy node hibernates and only in rare cases it becomes active again.
The authors of [28] present a distributed clustering procedure dividing a network into clusters in terms of the similarity of measurements and communication connectivity.The mechanism is proposed to secure distributed systems executing the average consensus algorithm.Using clustering techniques in consensus allows to detect and isolate faulty nodes, which allows other nodes to converge to the exact consensus value.
The authors of [29] proposed the mechanism to secure the systems against an attacker injecting a perturbation in the state of the nodes.They proposed the use of Set-Valued Observers that detect whether the state observations are compatible with the system dynamics.The detection rate achieves the values from 38.4% to 100%.
Within older solutions, MANNA proposed in [30] poses a mechanism worth a reader's attention.The algorithm assumes the presence of an external manager that is aware of the global information about the particular subparts of the network.Except this, it is able to execute complex tasks that would not be executable within the network.The mechanism is executed in such a way that each node checks its energy level and sends a message to the external manager in case of a change of the state.In terms of the obtained information, the manager is able to obtain the information about the energy level of the particular nodes according to which it is able to locate the corrupted nodes.The proposed mechanism poses a complex solution, although, at the cost of increased energy and financial demands.The authors of [31] present low-complex algorithm labeled as Distributed Localized Faulty Sensor Detection algorithm (DLFS), based on the principle that each node classifies itself as either good or faulty.This decision is executed according to the history values.Also, the neighbors of a particular node monitor this node and affect the final decision.When the values are changing too fast over the time, a node is very likely to be faulty.Within the executed experiments, the algorithm achieves 97% precision even though 25% of nodes are corrupted.In [32], the presented mechanism is based on a comparison of the measured information with the corrupted node's neighbors' median of the observed quantity.This solution poses energy-efficient mechanisms whose implementation is appropriate also for large-scale WSNs.However, it is not efficient in the networks with high failure probability and requires an expensive location device.
In contrast to the latest paper, our mechanism is proposed to detect the convergence/the divergence within the converging algorithms, which are used as a complement within WSNs.Thus, a proper functionality of the algorithm is what our classifier is able to detect in contrast to the related work, where a classifier detects a corrupted node / detects an abnormality within sensing / prevents false alarms from being sent / lengthen the lifetime of a network/ correct risen errors / ensures a reorganization of a network to minimize negative effects etc.
The divergence of the algorithm poses a serious problem because it paralyzes the network so significantly that it is unable to fulfill its functionality, meanwhile, the mentioned threats do not have to totally stun a whole network.This failure may result from an inappropriate configuration of a distributed algorithm and its correction poses a difficult task due to the distributed character of WSNs.Furthermore, in contrast to the majority of the latest works, the main advantage of our method is no requirement of any additional traffic in a network.The only redundancy compared with the unprotected version of the average consensus algorithm is the necessity of storing the information about the values of the finite difference from the previous two iterations.Thus, the proposed mechanism is a simple, fully-distributed, energy-undemanding and easy to implemented solution which ensures a high precision of the classification nevertheless.There is no similar mechanism to our classifier and therefore, our solution poses a significant novelty within a fault detection.Thus, a straight mutual comparison of our method with the existing ones is not possible because our classifier is based on the mathematical properties of the distributed converging algorithms.Only one comparable feature is the obtained precision, which is very high within our mechanism and indicates a high reliability of our classifier.We present a novel way of a failure detection -the mathematical features of the converging algorithms are used to detect the convergence/the divergence.

The Distributed Classifier of the Convergence/the Divergence
In this section, the main features of the proposed classifier have been provided.The novel classifier is a fully distributed mechanism to detect the convergence/the divergence in WSNs executing the average consensus algorithm.It is supposed to be efficient for all the distributed converging algorithms after a small modification (since the converging distributed algorithms might a bit differ from each other in the behavior).The process of classification is executed in such a way that it makes provision for the character of WSNs.As mentioned, it is a fully distributed mechanism that allows particular nodes to detect the convergence/the divergence just in terms of the inner states.Thus, no other additional information from the adjacent nodes is necessary to classify whether the network converges or diverges -which is very advantageous for the sake of the character of WSNs.Despite its simplicity, the mechanism ensures a high precision of a correct classification.The classification is executed according to two following rules: The validity of (11) indicates that the algorithm converges, as that of (12) indicates that the algorithm diverges.Here, Δk equals 1, which is the minimal change within the set of the integers.Thus, in order to detect the convergence/the divergence, each node has to store the information about the change of its inner values (last two changes).The used mathematical tool in (11) and ( 12) is called the forward finite difference of the first order and is defined as follows [33]: At the beginning of our analysis, we generated a random topology by applying the generator described in [34].We have provided a deep analysis of the average consensus in this network and implemented our classifier.We executed numerical experiments using the program Matlab.The topology of a randomly generated network consisting of 15 nodes is shown in Fig. 1.In Fig. 2, the behavior of the particular nodes from the presented network has been shown.The network converges since the condition ( 9) is fulfilled in this scenario.As we can see from the figure, there is a short interval during which the behavior is unpredictable.It is because not each node is aware of the value of the other nodes in a network.Its length is determined by the hop distance between the two farthest nodes in the network (the iteration equaling the maximal hop distance in the network + 1 is the iteration from which we are able to guarantee a high precision).Therefore, it is not possible to predict the behavior of the algorithm within this interval.Nevertheless, our novel mechanism can be used also within this interval, however, its precision cannot be guaranteed.This interval is ended by the iteration of the full awareness.From this iteration, our mechanism is effective and we guarantee its high precision.There is the other interval during which the mechanism reaches a high precision of detection.Within this interval, the algorithm converges to the average, but a small deviation may occur -an inner value is not approaching the average, however, it defers from it for a short time (usually only for one iteration).These deviations cause our mechanism not to achieve 100 % precision.Within the last interval, the mechanism achieves 100 % precision of the classification -we observe no deviation.The guaranteed phase is determined by the last two intervals.
In Fig. 3, we have shown the behavior of the particular nodes when the algorithm diverges.We can see that the behavior is significantly different compared with the previous scenario.The detection of this difference is the goal of our classifier.
In Fig. 4, we showed the behavior of the node whose initial value equals 10 and the classifier made an incorrect classification -since the algorithm iterates forever when it diverges, we have depicted just first 18 iterations.As we can see from Tab. 1, the presence of such abnormality is rare and likely only during earlier iterations of the algorithm.In the following part, we explain the proposed classifier in details.As mentioned, the average consensus algorithm is an iterative algorithm, i.e. each node sends its inner state to all its neighbors at every iteration.The behavior of the algorithm is unpredictable during the first iterations because the information of all the nodes is not included in the inner state of a particular node.During the guaranteed phase the inner state is assumed to converge to the final average value i.e. it slowly changes toward the final result and therefore, we assume that 1 2 ( 1 ) ( ) .
From Tab. 2, we can that the algorithm is unpredictable within the first iterations.This phase lasts only for the first 3.92 % of the whole process.During the guaranteed phase (96.08 % of the whole process), the nodes are able to classify whether the algorithm converges or diverges using our classifier.Let us focus on Fig. 3. where the inner states of one of the nodes are depicted when the algorithm diverges.The node with ID 10 has its inner state equaling 2.969 at the 14th iteration, 11.76 at the 15th iteration, 6.814 at the 16th iteration, and 4.5852 at the 17th iteration.The calculated finite differences for this interval are depicted in Tab. 2. In order to make the explanation clearer, the decisions for the 14th and 17th iterations have not been shown.

Iteration
The  As we can see the classification process at the 15th iteration is executed correctly, i.e. the node classifies that the algorithm diverges (which is true).However, the classifier makes a mistake because it classifies that the algorithm converges, but it does not.
As we can see from Tab. 1, the guaranteed precision equals 98.91% and therefore, our classifier can be considered to be a mechanism of a high precision.We show also the interval during which a high precision is not guaranteed.We can see that approximately 6.6667% of the classifications were incorrectly executed in this interval.Then we split the interval where the precision is guaranteed into two parts: the part in which incorrect classifications occurred and the error-free part.We can see that no incorrect classification occurred at 43.14% from all the iterations.At 52.94 % of the iterations, the classification is not error-free, however, it achieves a high precision -only 1.98% of the classifications were incorrect.

Numerical Experiments
As a presentation of a novel mechanism on only one topology does not ensure statistically credible results, we have executed other experiments on randomly generated networks with different features.We have generated two types of networks -strongly and weakly connected ones.In order to obtain statistically credible results within these experiments, each set consists of 20 networks with similar properties.As the range of the paper is not sufficient for all of them to be depicted, we have decided to show only one network from each set.In Fig. 5, we have depicted a representative of the strongly connected set.The solid circles represent the particular node; meanwhile the color lines indicate a direct connection between two nodes (and therefore, represent an edge).We can see that the mutual connectivity is good, i.e. the particular nodes have a lot of neighbors.The network depicted in Fig. 6 is a representative of the weakly connected set.We can see that the particular nodes are poorly connected.The reason why we decided for these two types of the networks is that a better connected node's update is affected by more values.Thus, it is more likely that the phenomenon shown in Fig. 4 occurs more often than in the less connected structure.The features of the randomly generated networks are shown in Tab. 3.

Fig. 1 .
Fig. 1.The example topology with the size of 15 nodes.

Fig. 2 .
Fig. 2. The behavior of the particular nodes when the algorithm converges.

Fig. 4 .
Fig. 4. The example of an incorrect classification -the circle highlights it.
The analysis of the example topology.