# Data-Driven Packet Loss Estimation for Node Healthy Sensing in Decentralized Cluster
## 4 The PingBasedDown Algorithm
### Decision Model
#### 4.2.1 Self-Checking Module  
At any time, a faulty node should not be selected as the leader. However, the evaluation model or other failure detection mechanisms cannot sense which side, i.e., whether themselves or their peers, is faulty. We thereby design this module to do self-checking and if one's self-checking procedure indicates that itself is faulty, it will abandon all the next steps and report this issue to the upper applications. More specifically, this module proposes the indicator \(I_{v}\) and the function of \(s^{\prime}_{n}\).  
With the basis of Lemma 1, Lemma 2 and Definition 5, we come up with the idea of this module that, if the majority of the nodes in the cluster announce that \(v_{f}(v_{f}\in V)\) is the faulty one using the evaluation module, \(v_{f}\) should be unhealthy. Although it is possible that all the announcers are unhealthy, however, in that case we can say that most of the nodes in the cluster have failed so that the cluster is totally out of function and it would be meaningless to discuss the reliability and availability. On the contrary of the condition of unhealthy, if the majority ones believe that \(v_{w}\) is healthy, \(v_{w}\) should be healthy although it is actually PendingHealthy which we have already discussed about.  
This idea can then be described as:  
\[\left\{\begin{aligned} & I_{v}(v_{i}):=\{v:v\in V\setminus\{v_{i}\}, \ (v,v_{i})\in E^{\prime}(v)\},\\ &\overline{I_{v}}(v_{i}):=\{v:v\in V\setminus\{v_{i}\},\ (v,v_{i})\in\overline{E}^{\prime}(v)\},\\ & s^{\prime}_{n}(I_{v})=\begin{cases}Unhealthy,&|\overline{I_{v} }|>[\frac{|V|}{2}],\\ Healthy,&|I_{v}|>[\frac{|V|}{2}]-1,\\ Pending,&\text{otherwise}.\end{cases}\end{aligned}\right. \tag{16}\]  
Unfortunately, the self-checking process is performed in \(v_{i}\), who has no knowledge about \(E^{\prime}(v)\) and \(\overline{E}^{\prime}(v)\), \(\forall v\in V\setminus\{v_{i}\}\). We thereby consider that \(s_{l}(v,v_{i})=s_{l}(v_{i},v)\). Because \(s^{\prime}_{l}(I_{n}(v,v_{i}))=s_{l}(v,v_{i})\) is expected, \(s^{\prime}_{l}(I_{n}(v_{i},v))=s^{\prime}_{l}(I_{n}(v,v_{i}))\) is also expected due to transitivity. Combine with (8) and (9), we have the following theorem:  
**Theorem 2**.: _If \((v_{i},v_{j})\in E^{\prime}(v_{i})\) then \((v_{j},v_{i})\in E^{\prime}(v_{j})\) and if \((v_{i},v_{j})\in\overline{E}^{\prime}(v_{i})\) then \((v_{j},v_{i})\in\overline{E}^{\prime}(v_{j})\)._  
With Theorem 2, the function of \(s^{\prime}_{n}\) can be easily calculated locally because (16) can be converted to:  
\[\left\{\begin{aligned} & I_{v}(v_{i})=\{v:v\in V\setminus\{v_{i}\}, (v_{i},v)\in E^{\prime}(v_{i})\},\\ &\overline{I_{v}}(v_{i})=\{v:v\in V\setminus\{v_{i}\},\ (v_{i},v)\in\overline{E}^{\prime}(v_{i})\}.\end{aligned}\right. \tag{17}\]  
If the self-checking result is healthy, this node should go forward to leader determination module. Otherwise, the node may suffer from network failure and it should handle this issue. If the result is pending, the node may do nothing but wait for more reliable link evaluation results.