Abstract
Aiming at the problem of fault detection in data collection in wireless sensor networks, this paper combines evolutionary computing and machine learning to propose a productive technical solution. We choose the classical particle swarm optimization (PSO) and improve it, including the introduction of a biological population model to control the population size, and the addition of a parallel mechanism for further tuning. The proposed RS-PPSO algorithm was successfully used to optimize the initial weights and biases of back propagation neural network (BPNN), shortening the training time and raising the prediction accuracy. Wireless sensor networks (WSN) has become the key supporting platform of Internet of Things (IoT). The correctness of the data collected by the sensor nodes has a great influence on the reliability, real-time performance and energy saving of the entire network. The optimized machine learning technology scheme given in this paper can effectively identify the fault data, so as to ensure the effective operation of WSN.
KEYWORDS: Particle swarm optimization, population size, parallel, back propagation neural network, wireless sensor networks, fault detection
1. Introduction
With the rapid expansion of the Internet of Things (IoT), people are no longer satisfied with the simple interconnection of people, machines, and things. It is an opportunity and challenge for the further development of the IoT to cope with and make full use of the massive real-time monitoring data. As the key core technology of the IoT, wireless sensor networks (WSN) have expanded from the initial military applications to many civilian fields such as agricultural planting, industry 4.0, smart home, environmental and ecological protection, medical and health monitoring, and traffic management [1,28]. It is inevitable that the amount of data will surge in WSN. How to manage these data scientifically to ensure the reliability, real-time and security of WSN has become an urgent problem to be solved. The introduction of artificial intelligence (AI) technology enables the whole IoT system including WSN to break through the bottleneck and upgrade.
Due to the continuous increase of data volume and the substantial improvement of computing ability, AI technology is full of vitality, and new algorithms emerge in endlessly. Among them, evolutionary algorithms are particularly active. Some algorithms are inspired by natural evolutionary phenomena, such as genetic algorithm (GA) [8] and differential evolution algorithm (DE) [7]. The ideas of some algorithms are derived from biological group behaviors, including particle swarm optimization (PSO) [16], cat swarm optimization (CSO) [5,36], grey wolf optimizer (GWO) [15,25], pigeon-inspired optimization (PIO) [35], etc. Some are related to physical theory or mathematical rules, such as sine cosine algorithm (SCA) [23,42], multi-verse optimizer (MVO) [24,39], QUATRE [22,21], etc. Due to its good robustness and excellent adaptive ability, the evolutionary algorithm can complete the optimization tasks of various objective functions based on a large amount of data and efficient algorithm mechanism, and effectively solve many difficult problems in the field of theoretical research and engineering technology [29].
Another high-frequency word in the field of AI is machine learning (ML). This is an interdisciplinary technology involving probability theory, statistics, algorithm complexity theory and other disciplines. It does not use direct programming, but mainly uses inductive and comprehensive methods to endow machine learning capabilities. The most basic way is to use algorithms to analyze data, extract information, learn rules, and then make decisions and predictions about events in the real world. From a practical operation level, ML is to use a large amount of data to train a model, and then use the model to predict [12]. There are multiple types of ML algorithms, each with its own characteristics. The naive Bayes algorithm can achieve simple probability-based classification, but it cannot learn the interaction between features and is prone to high deviation and low variance. Logistic Regression can effectively implement binary classifications, which is widely used in industry; however, it is prone to under-fitting and generally has low accuracy. Decision tree is a decision support tool that is easy to understand and explain, but it is prone to overfitting. As an important algorithm in ML, artificial neural network (ANN) realizes artificial intelligence by simulating the neural network of the human brain [11,37]. In recent years, the research work of ANN has been carried out continuously, and remarkable achievements have been made. Literature [6] used an adaptive neural network to plan routes for transportation vehicles to solve the problems of urban traffic congestion and environmental pollution. Literature [3] adopted Random Neural Networks to predict the stop-to-stop travel time for motor carriers. Literature [32] used neural networks for diabetic retinopathy fundus image classification. Literature [13] took advantage of Deep Neural Network models to estimate trends in prices of underlying stocks during pre and post Covid-19 periods.
The design goals of WSN can be summarized as four points: improving data quality, shortening response time, enhancing network security, and extending network lifetime. In order to achieve the above goals, anomaly detection technology is indispensable. Due to various uncontrollable factors, the appearance of abnormal data is inevitable. These erroneous data will not only increase network traffic and network delay, but also waste scarce energy. In addition, unreliable data will further affect subsequent data-based analysis and processing. Therefore, it is very necessary to detect the abnormal information in the collected data timely and effectively. Unfortunately, although some solutions have been proposed for this problem, the detection accuracy and speed still need to be further improved. The deep and extensive use of AI can provide a promising way for WSN to break through these technical bottlenecks.
According to the source of outlier data, anomaly detection can be divided into two types: one is based on faults, the other is based on abnormal events. This article focuses on the former. We combine evolutionary algorithms with ANN to identify the correctness of data collected by sensors in WSN. Specifically, this article creatively introduces the biological population control strategy to improve the classic PSO, and combines the parallel mechanism to significantly improve the optimization efficiency of the algorithm. Then use evolutionary calculation to optimize the structure configuration of the back propagation neural network (BPNN), and effectively realize the fault detection of WSN on the dataset.
The rest of this paper includes the following contents: the second part is related research work, which briefly introduces PSO, BPNN and anomaly detection in WSN respectively; the third part discusses the proposed RS-PPSO algorithm in detail; the fourth part specifically introduces the combination method and effect of RS-PPSO and BPNN; the fifth part is the simulation experiment of WSN data detection and the statistical analysis of data; the last part is the summary and future work.
2. Related works
2.1. Particle swarm optimization
PSO is a classical population-based intelligent optimization algorithm. First, a group of particles is initialized in the search space. Each particle represents a potential optimal solution of the extremum optimization problem, with three indicators of position, velocity and fitness value. The particle moves in the solution space, and the pre-defined fitness function is used to evaluate the pros and cons of its position. In each iteration, particles update their velocity and position by tracking individual historical extremum and population extremum. is the velocity of the particle in the dimension. The update formula is as follows:
| (1) |
Among them: is the current iteration number; is the inertia weight; and are learning factors, also called acceleration constants; and are random numbers between 0 and 1, which increase the randomness of particle movement. represents the current position of the particle, represents its historical optimal position, and represents the global optimal position of the current population. We define as a linearly decreasing weight, which is as follows:
| (2) |
where is the maximum number of iterations, and represents the initial value and final value of inertia weight respectively.
The position of the particle is updated according to the velocity change, as shown in the following formula:
| (3) |
As a typical stochastic optimization technology, PSO has been widely recognized in the field of intelligent computing. Since it was put forward in 1995, people’s enthusiasm for its research has remained unabated. A large number of scholars are engaged in more in-depth research and strive to improve the algorithm's global search ability and execution efficiency [40].
2.2. Back propagation neural network (BPNN)
ANN has good adaptability and excellent self-learning ability. It can approximate any nonlinear function by parallel distributed processing, and belongs to a supervised machine learning technology. Now it has been widely used in various fields of optimization problems, especially good at system identification and classification. Among many neural network models, BPNN is used most frequently, and its principle and algorithm are also the basis of some other models [10,14,31].
BPNN consists of input layer, hidden layer (one or more layers) and output layer. It is a kind of multi-layer feedforward network with unidirectional propagation. The learning process consists of four parts: input forward propagation, error back propagation, cyclic memory training and learning result discrimination. After initialization, the connection weights and biases of the network will be adjusted continuously during the training sample process, and the error between the network output value and the actual value is minimized through gradient descent. Taking three-layer BPNN as an example, suppose there are neurons in the hidden layer, and the input of the neuron is denoted as , which can be obtained by the following formula:
| (4) |
where is the ith input variable, is the number of input variable, is the connection weight between the neuron in the input layer and the neuron in the hidden layer, and is the bias of the neuron in the hidden layer.
Using the activation function , the output of the neuron in the hidden layer can be obtained by Equation (5). Similarly, we can also get the input and output of the output layer.
| (5) |
2.3. Fault detection in WSN
A large number of sensors in WSN cooperate with each other to perform application tasks, forming a data-centric wireless ad hoc network. Figure 1 shows a common WSN hierarchy. In the monitoring area, some sensor nodes are distributed to collect data about the perceived target [27,38]. A group of sensor nodes that are close to each other geographically form a cluster. Each cluster has a cluster head, which is responsible for collecting the data sensed by the sensor node, and then relaying the data to the sink node (base station) through the WSN self-organizing network. With the help of WSN, people can track climate change, warn dangerous environmental events, perceive information security situation and so on [4,17].
Figure 1.

Hierarchical architecture of WSN.
No matter what kind of application, requirements such as reliability, service life, real-time and throughput are put forward to different degrees for WSN, among which reliability is the basic requirement. It’s worth noting that the raw data collected is not always accurate and reliable. First of all, most of the sensors in WSN are cheap and of poor quality. Their battery energy, storage capacity, computing power and communication bandwidth are very limited, so it is easy to collect unreliable data. Secondly, in many practical applications, nodes are deployed in harsh environments. These environmental factors may reduce the reliability of the network, causing some nodes to fail, resulting in noise, errors, data loss, redundancy and so on during data transmission [19,34]. Furthermore, WSN is an open network, and the sensor nodes may face the security threats such as malicious attacks by hackers.
How to effectively ensure the reliability and accuracy of data collected by sensor nodes is a problem worthy of high attention in WSN. If the data collected by nodes are unreliable, it will not only reduce the quality of the original data and affect the overall performance of the network, but also directly affect the judgment of the real physical events that occur in the WSN. Anomaly detection technology provides a powerful means for timely and effective detection of abnormal data in WSN.
There are three types of abnormal data in WSN: noise and errors, real events, and malicious attacks. For the sake of ensuring data quality, this article mainly studies the first type of anomaly called error or failure. The solution proposed in this paper is based on the WSN architecture shown in Figure 1. The fault detection algorithm is deployed on the cluster heads, which will judge the correctness first, and then transmit the reliable data to the beacon node.
3. Improvements to PSO
Similar to other meta-heuristic algorithms, PSO has the problems of local optimal stagnation and low convergence accuracy. Scholars have made a lot of attempts to improve it, such as adjusting its parameters, hybrid with other algorithms, and also put forward the binary version [9], which has achieved good results. However, there are few studies on the population size of PSO. The so-called population size refers to the number of individuals in the population, which has a great influence on the optimization performance of the algorithm. The larger the population size, the better the diversity, and the smaller the risk of the algorithm falling into a local optimum. However, the amount of calculation will increase and the operating efficiency will decrease. If the population size is small, the calculation speed of the algorithm is faster, but due to the limited search space, it is prone to premature convergence. The population size of most algorithms is constant throughout the evolution process, even if it changes, it is relatively rigid and lacks sufficient reasonable basis. This paper draws on the dynamic regulation mechanism of biological populations and proposes a Reverse-S curve (RS) population size control strategy, which simulates the biological evolutionary characteristics of the ‘survival of the fittest’ in nature, and gradually reduces the size of PSO population until the algorithm converges. At the same time, in order to avoid losing excellent solutions, we subsequently parallelized PSO (PPSO). In this paper, the proposed PPSO based on RS strategy (RS-PPSO) is tested on CEC2013, and satisfactory optimization results were achieved.
3.1. Population size control strategy based on reverse-S curve (RS)
In nature, as the density of biological populations increases, the struggle between individuals of the same species will inevitably intensify due to limited living space, food sources and other living conditions. In addition, the number of predators feeding on this species will increase correspondingly, thus inhibiting the growth of the population. When the population size reaches the maximum value allowed by environmental conditions, it will stop growing and remain relatively stable. Its overall trend is similar to an S-shaped curve, as shown in Figure 2(a). The established mathematical model is called logistic model, which shows the change trend of individual number with time . The specific formula is as follows:
| (6) |
where is the population growth rate. is the intrinsic growth rate, that is, the maximum instantaneous growth rate of the population, which reflects the ability of the biological population to expand under the ideal state.
Figure 2.
(a) Logistic model of biological population. (b) Population size change curve based on RS strategy.
In order to simulate the natural environment objectively and truthfully, dual populations with a competitive relationship can be set, and the S-curve model can be obtained by the following formula:
| (7) |
Among them, for the first population, the intrinsic growth rate is , the initial size is , and the resource consumption rate is . The initial size of the second population is . The maximum number of individuals in the two populations are and , respectively.
The evolutionary algorithm needs to use a larger population for extensive exploration in the initial stage. As the number of iterations increases, the feasible solutions gradually converge to the optimal position, and the search space shrinks accordingly. The S-shaped curve in Figure 2(a) can be reversed to control the trend of population decline, as shown in Figure 2(b). The specific parameters are: , , , . The pseudo code of RS-based population size control strategy is shown in Figure 3.
Figure 3.
Pseudo code of RS strategy.
3.2. Parallel PSO based on RS strategy (RS-PPSO)
According to the RS strategy, at the end of each iteration of PSO, some individuals are randomly deleted, which may lose some potential solutions and destroy the diversity of the population. In order to avoid these adverse effects, we parallelized the algorithm. The initial population is divided into several co-evolved sub-populations. This does not increase the complexity of the algorithm, but it can effectively avoid the above risks. The algorithm steps of RS-PPSO are as follows:
Initialization:
Initialize the population and related parameters, and divide into 4 groups: .
Evaluation:
Evaluate the fitness value of each particle in the population.
Update:
Use Equation (1) and (3) to update the velocity and position of each particle. And update the individual historical optimal and the global optimal of each group.
Communication:
Communicate between groups every generations: randomly combine 4 groups in pairs to obtain two group sets: and . The optimal values in the two sets are and , and one of them is randomly selected to replace the global optimal of the population.
RS strategy:
Use to reduce the population size.
Termination:
Repeat steps 2 to 5. If a predefined function value has been obtained or all iterations have been completed, record the global optimal particle and its fitness value, and the optimization process ends.
3.3. Statistics and analysis of experimental results
In order to investigate the effectiveness of the proposed RS-PPSO algorithm, this paper uses some CEC2013 benchmark functions for testing, including 3 single-mode functions , 5 multi-mode functions and 4 complex functions , as shown in Table 1.
Table 1.
Benchmark functions used for testing.
| Sphere Functions | ||||
| Rotated High Conditioned Elliptic Functions | ||||
| Different Powers Function | ||||
| Rotated Rosenbrock's Functions | ||||
| Rotated Ackley's Functions | ||||
| Rastrigin's Functions | ||||
| Rotated Rastrigin's Functions | ||||
| Rotated Katsuura Functions | ||||
| Composition Functions 1 (n = 5, Rotated) | ||||
| Composition Functions 4 (n = 3, Rotated) | ||||
| Composition Functions 6 (n = 5, Rotated) | ||||
| Composition Functions 7 (n = 5, Rotated) |
For fairness considerations, PSO, RS-PSO, and PPSO [2] are included in the comparison. Each benchmark function runs 30 times independently, and the optimal value, mean value (Mean) and standard deviation (Std) are respectively calculated to ensure the comprehensiveness of the algorithm performance evaluation. The detailed experimental results are recorded in Table 2. In the test of single-mode functions , RS-PPSO has the best indicators except for the standard deviation in , which ranks second. This type of function has no local optimum and only one optimal value. The outstanding performance of RS-PPSO in solving such problems shows that it has good exploitation capabilities and convergence property. In the test of multi-modal functions , although the mean and standard deviation of RS-PPSO did not win the best in half of the cases, its optimal value always ranked first. This type of function has more than one optimal values, presenting multiple peaks and valleys. The performance of RS-PPSO shows that it can effectively avoid the local optimum and find the global optimum with its excellent exploration ability. In the test of complex functions , the advantages of RS-PPSO have been challenged. The specific results are as follows: 3 times to win the best value, 1 time to get the mean value first, and 2 times to get the standard deviation first. Especially in the test of , all three indicators are not ideal. However, the overall performance of RS-PPSO in solving complex problems is still ranked first, which once again shows its reliable competitiveness.
Table 2.
Descriptive statistics of the compared algorithms based on benchmark functions.
| Functions | Algorithms | Optimal value | Mean | Std |
|---|---|---|---|---|
| PSO | −1399.5598 | −703.582 | 8.33E-06 | |
| RS-PSO | −1399.9995 | −639.91 | 4.3594 | |
| PPSO | −1399.2076 | −1395.4 | 3.3271 | |
| RS-PPSO | −1400 | −1400 | 8.44E-08 | |
| PSO | 382,037.3106 | 382,080.9 | 236.3604 | |
| RS-PSO | 2,414,841.216 | 38,554,103 | 231,777.7 | |
| PPSO | 1,065,048.06 | 41,458,644 | 358,997.2 | |
| RS-PPSO | 360,403.0622 | 376,250.8 | 202.9221 | |
| PSO | −999.2854 | −566.055 | 5.76E-08 | |
| RS-PSO | −998.9334 | −999.159 | 2.2307 | |
| PPSO | −999.3748 | −567.884 | 1.7959 | |
| RS-PPSO | −999.9593 | −999.281 | 0.001962 | |
| PSO | −779.1782 | −778.097 | 2.88E-07 | |
| RS-PSO | −779.1343 | −778.023 | 0.52722 | |
| PPSO | −819.3166 | −818.313 | 1.0039 | |
| RS-PPSO | −819.3273 | −818.284 | 1.44E-05 | |
| PSO | −651.1763 | −648.0914 | 0.088152 | |
| RS-PSO | −619.8842 | −619.884 | 0.15728 | |
| PPSO | −698.1833 | −641.788 | 0.86731 | |
| RS-PPSO | −697.7103 | −697.181 | 0.08136 | |
| PSO | −357.1551 | −349.155 | 7.6039 | |
| RS-PSO | −332.8019 | −330.795 | 3.72E-09 | |
| PPSO | −379.9658 | −377.184 | 8.7325 | |
| RS-PPSO | −389.6698 | −389.649 | 0.67444 | |
| PSO | −171.4748 | −97.5388 | 5.5018 | |
| RS-PSO | −214.4211 | −189.421 | 7.27E-09 | |
| PPSO | −216.2985 | −210.6747 | 7.1024 | |
| RS-PPSO | −239.2413 | −202.064 | 11.7167 | |
| PSO | 201.496 | 214.8906 | 0.72923 | |
| RS-PSO | 201.496 | 208.1511 | 7.4464 | |
| PPSO | 201.6597 | 215.4416 | 1.4492 | |
| RS-PPSO | 200.5858 | 212.0354 | 0.72877 | |
| PSO | 1109.0322 | 1355.553 | 21.9479 | |
| RS-PSO | 1068.8271 | 1317.436 | 7.3674 | |
| PPSO | 984.489 | 1267.365 | 12.6841 | |
| RS-PPSO | 979.7033 | 986.6013 | 3.8858 | |
| PSO | 1226.8515 | 1247.425 | 1.98E-08 | |
| RS-PSO | 1047.8569 | 926.852 | 125.5263 | |
| PPSO | 1044.8651 | 1470.528 | 241.5447 | |
| RS-PPSO | 1162.5903 | 1222.541 | 444.9381 | |
| PSO | 1504.9421 | 1540.705 | 6.508 | |
| RS-PSO | 1400.4945 | 1400.073 | 0.15457 | |
| PPSO | 1340.636 | 1329.866 | 1.9151 | |
| RS-PPSO | 1400.0698 | 1489.29 | 0.016832 | |
| PSO | 2077.7434 | 2079.112 | 25.9145 | |
| RS-PSO | 2084.2959 | 2407.365 | 2.801 | |
| PPSO | 2075.5592 | 2406.103 | 20.9206 | |
| RS-PPSO | 2052.3841 | 2383.231 | 24.037 | |
| Statistics of the number of wins | PSO | 0 | 0 | 3 |
| RS-PSO | 0 | 3 | 3 | |
| PPSO | 3 | 3 | 0 | |
| RS-PPSO | 9 | 6 | 6 |
Note: The best values are marked in bold.
The convergence curves of the test functions are shown in Figure 4. Analysis of the data shows that the three types of statistical data obtained by the RS-PPSO algorithm in the test of different types of benchmark functions have obvious advantages over other algorithms that participated in the comparison. As a stochastic optimization algorithm, although occasionally did not achieve the best results, it still shows the robustness of optimization capabilities.
Figure 4.
The convergence curves of test functions.
Although descriptive statistics such as the mean and standard deviation are calculated for the optimization results of the algorithms, it is necessary to further explore whether there are significant differences between the optimization performance of each algorithm. Because a seemingly existing difference may actually be caused by accident rather than inevitable. For the evaluation of experimental results data, we need to use clear and objective indicators to explain it, which is the significance of statistical test. In statistics, there is a statistical hypothesis testing called significance test, which can be used to detect whether there is a difference between the experimental groups and whether the difference is significant.
First establish statistical hypotheses, which are the prerequisites for statistical testing. Generally speaking, the hypothesis to be tested is called the null hypothesis, which is recorded as ; the hypothesis corresponding to or opposite to is called the alternative hypothesis, which is recorded as . When is true, but the conclusion of the test supports giving up, the probability of this type of error is recorded as , which is called the significance level. Generally, there are three cases of = 0.05, 0.025 and 0.01, which means that the error rate of the conclusion of the significance test must be less than 5% or 2.5% or 1%. An important basis for the testing decision is - , which reflects the probability of an event. If - obtained by significance test is less than the significance level , it is considered that there is a statistical difference.
The significance test can be divided into parameter test and nonparametric test. Strictly speaking, parameter test requires samples to obey normal distribution and have the same variance. Based on this basic assumption, test whether the mean value of each sample is equal. When the data does not satisfy the hypothesis of normality and homogeneity of variance, nonparametric test based on rank should be used.
In the current experimental process, we want to judge whether the performance difference between the proposed RS-PPSO and the compared algorithms is purely opportunistic mutation or can reliably reflect the real situation of the whole. The four algorithms of PSO, RS-PSO, PPSO and RS-PPSO were independently run 30 times on 12 benchmark functions, and the optimization results were recorded. In view of the nature of the data, we choose Independent-Samples T-Test. This is a statistic method to compare whether there is a significant difference between two samples in a continuous variable, and belongs to the category of parameter test. So it can be used to complete the pairwise comparisons between RS-PPSO and PSO, RS-PSO, PPSO in terms of optimized performance. It is found that the optimization results obey normal distribution. In fact, due to the higher efficiency and accuracy of the parameter test, we can still choose the T-Test even if the data is slightly skewed. The null hypothesis of the Independent-Samples T-Test is that the mean values of the two samples are equal. Corresponding to the experiment in this article, the optimization performance of RS-PPSO and the compared algorithm is equivalent, and there is no difference (marked as ‘ ’). The alternative hypothesis is that there is a significant difference in optimization performance between the two algorithms. The significance level is set to 0.05. If - , reject the null hypothesis and accept the alternative hypothesis. If - , the null hypothesis can be accepted. If there is a significant difference, then examine what the difference is. That is to compare the mean value of the optimization results, so as to judge whether the optimization performance of RS-PPSO is better than (marked as ‘ ’) or weaker than (marked as ‘ ’) the compared algorithm. The specific statistical results are shown in Table 3. From the perspective of statistics, there is a significant difference between the optimization performance of RS-PPSO and the compared algorithms in general, and it is better than the other three algorithms in most cases.
Table 3.
Independent sample T-Test results of RS-PPSO and three comparison algorithms.
| Functions | PSO | RS-PSO | PPSO |
|---|---|---|---|
4. Combination of RS-PPSO and BPNN
BPNN has been relatively mature in network theory, with flexible network structure and excellent nonlinear mapping capability. But its performance is closely related to samples, parameters, network structure and so on. Especially, since the network is a nonlinear system, the initial weights and biases have great influence on the optimization accuracy and convergence speed of the learning algorithm. Generally, the weights and biases of BPNN are initialized randomly. It can be said that this parameter setting method is very arbitrary, and the subsequent self-learning mechanism must be used to optimize the parameters of the model to the best state.
The improved PSO proposed in this paper can not only effectively avoid local optima, but also has high optimization efficiency. It can assist in setting the initial weights and biases of BPNN with its excellent optimization ability, thereby shortening the training time and ultimately improving the prediction results. The combination mechanism of the two is shown in Figure 5.
Figure 5.
The combination mechanism of RS-PPSO and BPNN.
The BPNN structure used in this article is 2-3-1, as shown in Figure 6. The weights and biases are expressed as follows:
| (8) |
Figure 6.

The BPNN structure of 2-3-1.
And these weights and biases constitute the solution of the evolutionary algorithm: . Assuming there are samples, the expected output of the sample is , and the actual output is . Construct the fitness function as the mean square error (MSE) of the training sample, as shown in Equation (9).
| (9) |
5. Simulation of fault detection in WSN
In WSN, the data collected by sensor nodes are likely to have faults. There are many classification methods for fault types, such as hardware faults and software faults, as well as persistent faults and transient faults. Considering solely from the data itself, the data faults can be divided into: offset fault, gain fault, out of bounds, data loss, stuck-at fault, etc. These faults can be identified according to some characteristics of the data [26,45]. In this part, the proposed RS-PPSO and BPNN will be jointly used to detect sensor data faults in WSN. The data set used in this paper comes from the literature [33], which contains single-hop and multi-hop data collected from indoor and outdoor WSNs, specifically humidity and temperature measurements collected at 5-second intervals within 6 hours.
Effective fault detection requires both a high detection accuracy rate and a low false positive rate. So we use two indicators for evaluation: Detection accuracy (DA), which indicates the proportion of correctly detected fault data to all fault data; and False positive rate (FPR), which means the proportion of correct data that is misjudged as incorrect data to all correct data. Please see Equation (10) and (11).
| (10) |
| (11) |
In order to test the effectiveness of the algorithm in WSN fault detection, a series of simulation experiments were carried out. Table 4 records the two index values of DA and FPR obtained by the three classification algorithms on 8 data subsets. The results show that after the optimization of PSO, the classification performance of BPNN has been significantly improved. Adopting the RS-PPSO proposed in this article can further greatly increase DA and reduce FPR.
Table 4.
Detection accuracy (DA) and false positive rate (FPR) of the proposed combination of RS-PPSO and BPNN.
| Single-hop | Multi-hop | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Indoor | Outdoor | Indoor | Outdoor | ||||||
| Node 1 | Node 2 | Node 3 | Node 4 | Node 1 | Node 2 | Node 3 | Node 4 | ||
| BPNN | DA | 0.70654 | 0.82697 | 0.75443 | 0.82111 | 0.81462 | 0.84223 | 0.94362 | 0.69442 |
| FPR | 0.26783 | 0.16493 | 0.14256 | 0.20116 | 0.17432 | 0.15981 | 0.14678 | 0.22463 | |
| PSO + BPNN | DA | 0.76844 | 0.87694 | 0.76899 | 0.84464 | 0.82264 | 0.85962 | 0.93221 | 0.74362 |
| FPR | 0.21139 | 0.13246 | 0.13996 | 0.16431 | 0.15131 | 0.14336 | 0.15223 | 0.17231 | |
| RS-PPSO + BPNN | DA | 0.83704 | 0.91643 | 0.85113 | 0.87261 | 0.85469 | 0.87464 | 0.94302 | 0.80664 |
| FPR | 0.10214 | 0.09971 | 0.12014 | 0.14231 | 0.13247 | 0.12143 | 0.14770 | 0.13259 | |
Note: The best values are marked in bold.
In addition, based on the fitness function Equation (9), the prediction errors of the three algorithms are compared. Each algorithm runs 20 times independently, and records the statistical data: best value, mean value and standard deviation. The detailed data are shown in Table 5. It can be seen that the RS-PPSO + BPNN proposed in this paper has the best three indicators, and its classification accuracy has been greatly improved compared with the original BPNN.
Table 5.
Comparison of the three algorithms: BPNN, PSO + BPNN, RS-PPSO + BPNN using descriptive statistics.
| BPNN | PSO + BPNN | RS-PPSO + BPNN | |
|---|---|---|---|
| Best | 5.42E-05 | 1.30E-08 | 8.21E-10 |
| Mean | 6.47E-05 | 7.81E-08 | 2.14E-09 |
| Std. | 2.27E-02 | 3.92E-03 | 7.08E-04 |
Note: The best values are marked in bold.
Figure 7 shows the convergence curves of the prediction errors of the four classification algorithms, namely: PSO + BPNN, RS-PSO + BPNN, PPSO + BPNN and RS-PPSO + BPNN. The convergence of classification accuracy of different algorithms can be clearly seen from the graph. The PSO + BPNN algorithm tends to fall into the local optimum prematurely. The addition of the parallel mechanism helps PPSO + BPNN to improve the classification effect, but it will lose some convergence speed. The RS strategy can significantly improve the optimization efficiency, and with the support of the parallel strategy, the classification accuracy and speed of RS-PPSO + BPNN are both optimal.
Figure 7.

Comparison of fitness function curves of four algorithms: PSO + BPNN, RS-PSO + BPNN, PPSO + BPNN, RS-PPSO + BPNN.
6. Conclusion
Machine learning is the core of AI and the fundamental way to make computers intelligent. In order to ensure the reliability of data collection in WSN, this paper uses two technologies: active evolutionary computation and classic neural network. The idea of evolutionary algorithm comes from nature. It is wise to return to nature to find the answer when problems arise. This paper introduces the biological population model to control the population size of PSO. Supplemented by parallel processing, the RS-PPSO algorithm with excellent optimization performance is proposed. The improved evolutionary algorithm combined with BPNN has achieved remarkable results in WSN data detection. Compared with WSN research directions such as node location, signal coverage, and routing, the field of data detection deserves more attention. The technical scheme given in this paper has been proved feasible and effective in experimental simulation. In future work, we can consider the use of evolutionary algorithms specifically for computationally difficult problems to solve big data and large-dimensional problems [18,41,43]. It is necessary to continue the research on the population size of evolutionary algorithms, and more mathematical theories and methods can be introduced [20,30,44]. We will also try to broaden the scope of applications and use computational intelligence to solve more practical problems.
Disclosure statement
No potential conflict of interest was reported by the author(s).
References
- 1.Chang E., Potdar V., and Sharif A., Wireless sensor networks: a survey, in 2013 27th International Conference on Advanced Information Networking and Applications Workshops, IEEE, Bradford, 2009, pp. 636–641.
- 2.Chang J.F., Roddick J.F., Pan J.S., and Chu S.C., A parallel particle swarm optimization algorithm with communication strategies. J. Inf. Sci. Eng. 21 (2005), pp. 809–818. [Google Scholar]
- 3.Chen C.H., An arrival time prediction method for bus system. IEEE Internet Things 5 (2018), pp. 4231–4232. [Google Scholar]
- 4.Chu S.C., Dao T.K., and Pan J.S., Identifying correctness data scheme for aggregating data in cluster heads of wireless sensor network based on naive Bayes classification. J. Wireless. Com. Netw. 52 (2020), pp. 1–15. [Google Scholar]
- 5.Chu S.C., Tsai P.W., and Pan J.S., Cat swarm optimization, in PRICAI 2006: Trends in Artificial Intelligence, Vol. 4099. IEEE, Berlin, 2006, pp. 854–858.
- 6.Cirović G., Pamučar D., and Božanić D., Green logistic vehicle routing problem: routing light delivery vehicles in urban areas using a neuro-fuzzy model. Expert Syst. Appl. 41 (2014), pp. 4245–4258. [Google Scholar]
- 7.Das S. and Suganthan P.N., Differential evolution: a survey of the state-of-the-art. IEEE Trans. Evolut. Comput. 15 (2011), pp. 4–31. [Google Scholar]
- 8.Deb K., Samir A., Amrit P., and Meyarivan T., A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE Trans. Evolut. Comput. 6 (2002), pp. 182–197. [Google Scholar]
- 9.Deliorman G. and Inan D., Binary particle swarm optimization as a detection tool for influential subsets in linear regression. J. Appl. Stat. 47 (2020), pp. 1–16. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Deng W.J., Chen W.C., and Pei W., Back-propagation neural network based importance–performance analysis for determining critical service attributes. Expert Syst. Appl. 34 (2008), pp. 1115–1125. [Google Scholar]
- 11.Fescioglu-Unver N. and Tanyeri B., A comparison of artificial neural network and multinomial logit models in predicting mergers. J. Appl. Stat. 40 (2013), pp. 712–720. [Google Scholar]
- 12.Gao F.Y., Hsieh J.G., and Jeng J.H., A study on combined CNN-SVM model for visual object recognition. JIHMSP 10 (2019), pp. 479–487. [Google Scholar]
- 13.Ghosh I. and Chaudhuri T.D., FEB-stacking and FEB-DNN models for stock trend prediction: a performance analysis for pre and post covid-19 periods. Decis. Mak. Appl. Manag. Eng. 4 (2021), pp. 51–84. [Google Scholar]
- 14.Hossain A. and Nasser M., Comparison of the finite mixture of ARMA-GARCH, back propagation neural networks and support-vector machines in forecasting financial returns. J. Appl. Stat. 38 (2011), pp. 533–551. [Google Scholar]
- 15.Hu P., Pan J.S., and Chu S.C., Improved binary grey wolf optimizer and its application for feature selection. Knowl.-Based Syst. 195 (2020), pp. 105746–105759. [Google Scholar]
- 16.Kennedy J. and Eberhart R., Particle swarm optimization, in Proceedings of the IEEE International Conference on Neural Networks, Vol. 4. IEEE, Perth, 1995, pp. 1942–1948.
- 17.Kung H.Y., Chen C.H., and Ku H.H., Designing intelligent disaster prediction models and systems for debris-flow disasters in Taiwan. Expert Syst. Appl. 39 (2012), pp. 5838–5856. [Google Scholar]
- 18.Liu N.X., Pan J.S., Sun C.L., and Chu S.C., An efficient surrogate-assisted quasi-affine transformation evolutionary algorithm for expensive optimization problems. Knowl.-Based Syst. 209 (2020), pp. 106418–106429. [Google Scholar]
- 19.Mahapatro A. and Khilar P.M., Fault diagnosis in wireless sensor networks: a survey. IEEE Commun. Surv. Tutor. 15 (2013), pp. 2000–2026. [Google Scholar]
- 20.McKeague I.W. and Zhao Y., Simultaneous confidence bands for ratios of survival functions via empirical likelihood. Statist. Probab. Lett. 60 (2002), pp. 405–415. [Google Scholar]
- 21.Meng Z.Y. and Pan J.S., QUasi-Affine TRansformation Evolution with external ARchive (QUATRE-EAR): an enhanced structure for differential evolution. Knowl.-Based Syst. 155 (2018), pp. 35–53. [Google Scholar]
- 22.Meng Z.Y., Pan J.S., and Xu H., QUasi-Affine TRansformation evolutionary (QUATRE) algorithm: a cooperative swarm based algorithm for global optimization. Knowl.-Based Syst. 109 (2016), pp. 104–121. [Google Scholar]
- 23.Mirjalili S., SCA: a sine cosine algorithm for solving optimization problems. Knowl.-Based Syst. 96 (2016), pp. 120–133. [Google Scholar]
- 24.Mirjalili S., Mirjalili S.M., and Hatamlou A., Multi-verse optimizer: a nature-inspired algorithm for global optimization. Neural Comput. Appl. 27 (2016), pp. 495–513. [Google Scholar]
- 25.Mirjalili S., Mirjalili S.M., and Lewis A., Grey wolf optimizer. Adv. Eng. Softw. 69 (2014), pp. 46–61. [Google Scholar]
- 26.Muhammed T. and Shaikh R.A., An analysis of fault detection strategies in wireless sensor networks. J. Netw. Comput. Appl. 78 (2017), pp. 267–287. [Google Scholar]
- 27.Munir A., Antoon J., and Gordon-Ross A., Modeling and analysis of fault detection and fault tolerance in wireless sensor networks. ACM Trans. Embed. Comput. Syst. 14 (2015), pp. 1–43. [Google Scholar]
- 28.Pan J.S., Chai Q.W., Chu S.C., and Wu N., 3-D terrain node coverage of wireless sensor network using enhanced black hole algorithm. Sensors 20 (2020), pp. 2411–2422. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Pan J.S., Song P.C., Chu S.C., and Peng Y.J., Improved compact cuckoo search algorithm applied to location of drone logistics hub. Mathematics 8 (2020), pp. 333–351. [Google Scholar]
- 30.Phoungphol P., Zhang Y.Q., and Zhao Y.C., Robust multiclass classification for learning from imbalanced biomedical data. Tsinghua Sci. Technol. 17 (2012), pp. 619–628. [Google Scholar]
- 31.Rumelhart D.E., Hinton G.E., and Williams R.J., Learning representations by back-propagating errors. Nature 323 (1986), pp. 533–536. [Google Scholar]
- 32.Shankar K., Zhang Y., Liu Y., Wu L., and Chen C.H., Hyperparameter tuning deep learning for diabetic retinopathy fundus image classification. IEEE Access 8 (2020), pp. 118164–118173. [Google Scholar]
- 33.Suthaharan S., Alzahrani M., Rajasegarar S., Leckie C., and Palaniswami M., Labelled data collection for anomaly detection in wireless sensor networks, in 2010 Sixth International Conference on Intelligent Sensors, Sensor Networks and Information Processing, IEEE, Brisbane, 2010, pp. 269–274.
- 34.Tang P. and Chow T.W.S., Wireless sensor-networks conditions monitoring and fault diagnosis using neighborhood hidden conditional random field. IEEE Trans. Ind. Inform. 12 (2016), pp. 933–940. [Google Scholar]
- 35.Tian A.Q., Chu S.C., Pan J.S., Cui H.Q., and Zheng W.M., A compact pigeon-inspired optimization for maximum short-term generation mode in cascade hydroelectric power station. Sustainability 12 (2020), pp. 767–785. [Google Scholar]
- 36.Tsai P.W., Pan J.S., Chen S.M., and Liao B.Y., Enhanced parallel cat swarm optimization based on the Taguchi method. Expert Syst. Appl. 39 (2012), pp. 6309–6319. [Google Scholar]
- 37.Wang C.X., Shi T.B., Tang L.L., and Chen Y.C., Design of neural network model for lightweight 3D point cloud classification. JNI 5 (2020), pp. 122–128. [Google Scholar]
- 38.Wang J., Gao Y., Liu W., Wu W., and Lim S.J., An asynchronous clustering and mobile data gathering schema based on timer mechanism in wireless sensor networks. CMC-Comput. Mater. Con. 58 (2019), pp. 711–725. [Google Scholar]
- 39.Wang X.P., Pan J.S., and Chu S.C., A parallel multi-verse optimizer for application in multilevel image segmentation. IEEE Access 8 (2020), pp. 32018–32030. [Google Scholar]
- 40.Xia X.W., Tang Y.C., Wei B., Zhang Y.L., and Li X., Dynamic multi-swarm global particle swarm optimization. Computing 102 (2020), pp. 1587–1626. [Google Scholar]
- 41.Xue X.S. and Lu J.W., A compact brain storm algorithm for matching ontologies. IEEE Access 8 (2020), pp. 43898–43907. [Google Scholar]
- 42.Yang Q.Y., Chu S.C., Pan J.S., and Chen C.M., Sine cosine algorithm with multigroup and multistrategy for solving CVRP. Math. Probl. Eng. 12 (2020), pp. 1–10. [Google Scholar]
- 43.Yu H.B., Tan Y., Sun C.L., Zeng J.C., and Jin Y., An adaptive model selection strategy for surrogate-assisted particle swarm optimization algorithm, in 2016 IEEE Symposium Series on Computational Intelligence, IEEE, Athens, 2016, pp. 1–8.
- 44.Zhang H., Feng F., Jing B., and Li Y., Almost periodic solution of a multispecies discrete mutualism system with feedback controls. Discrete Dyn. Nat. Soc. 3 (2015), pp. 1–14. [Google Scholar]
- 45.Zidi S., Moulahi T., and Alaya B., Fault detection in wireless sensor networks through SVM classifier. IEEE Sens. J. 18 (2018), pp. 340–347. [Google Scholar]




