# Fatigue Crack and Residual Life Prediction Based on an Adaptive Dynamic Bayesian Network
## 2 Principle and Methods
### Introduction to Particle Filter
#### 2.3.3 Sequential Importance Sampling  
The most basic particle filtering algorithm for sampling in posterior probability distribution is Sequential Importance Sampling (SIS) [31]. Assuming that \(N\) samples can be sampled from the posterior probability, the calculation of posterior probability can be represented as follows:  
\[P(\mathbf{X}_{t}|\mathbf{Z}_{1:t})=\frac{1}{N}\sum_{i=1}^{N}w_{t}^{i}\delta\Big{(}\bm {X}_{t}-\mathbf{X}_{t}^{i}\Big{)} \tag{14}\]  
where \(\delta\) is the Dirac function. \(w_{t}^{i}\) is the weight of the particle.  
In other words, the new state \(\mathbf{X}_{t}^{i}\) of the \(i\)th particle at the time step \(t\) is sampled from the distribution with the current state and the observed value \(\mathbf{Z}_{1:t}\) as parameters.  
At time step \(t\), the weight \(w_{t}^{i}\) is updated from \(w_{t-1}^{i}\) to the following:  
\[w_{t}^{i}\propto w_{t-1}^{i}\frac{P\Big{(}\mathbf{Z}_{t}\Big{|}\mathbf{X}_{t}^{i}\Big{)} P\Big{(}\mathbf{X}_{t}^{i}\Big{|}\mathbf{X}_{t-1}^{i}\Big{)}}{q\Big{(}\mathbf{X}_{t}^{i} \Big{|}\mathbf{X}_{t-1}^{i},\mathbf{Z}_{t}\Big{)}} \tag{15}\]  
The SIS algorithm has a problem where the variance in the weights \(w\) increases with multiple iterations, and it is even possible for one weight to approach 1 while the others tend toward 0, a phenomenon known as particle degeneracy. This leads to a substantial waste of computational time on the majority of particles with excessively small weights. An effective method to mitigate particle degeneracy is through resampling [32], which involves randomly replicating particles with higher weights and eliminating those with lower weights, thereby focusing the computation as much as possible on particles that have a greater impact on the posterior probability density. In addition, the initial state \(\mathbf{X}_{0}^{i}\) is sampled from the joint prior distribution of the state variables, and the initial weight of each particle is \(1/N\). The pseudocode for the standard particle filter algorithm flow is as follows:  
1. [label=(0)]
2. Particle set initialization, \(T=0\): For \(i=1\), \(2\), \(\ldots\), \(N\). Generate sampling particle \(\left\{x_{0}^{i}\right\}_{i=1}^{N}\) from prior p(\(x_{0}\)).
3. For \(T=1\), \(2\), \(\ldots\), \(t\). Cycle through the following steps: 1. [label=(0)]
4. Importance sampling for \(i=1\), \(2\), \(\ldots\), \(N\). The sampling particle \(\left\{x_{t}^{i}\right\}_{i=1}^{N}\) is generated from the importance probability density; the particle weight \(w_{t}^{i}\) is calculated and normalized. 2. Resample: Resample the particle set \(\left\{x_{t}^{i},w_{t}^{i}\right\}\). The resampled particle set is \(\left\{\tilde{x}_{t}^{i},1/N\right\}\). The conversion weight \(\widetilde{w}_{t}\) is recorded as \(\sum\limits_{i=1}^{N}\widetilde{w}_{t}^{i}x_{t}^{i}=\sum\limits_{i=1}^{N} \tilde{x}_{t}^{i}\). 3. Output: calculate the state estimation value at time \(t_{t}\hat{x}_{t}=\sum\limits_{i=1}^{N}\tilde{x}_{t}^{i}\).  
The process of multiple resamplings tends to replicate particles with higher weights excessively, culminating in a final collection largely made up of identical particles. Such a reduction in the diversity of particles can lead to diminished predictive accuracy, a scenario referred to as particle impoverishment. The conventional approach to mitigate this involves augmenting the initial pool of particles and incorporating new particles throughout the filtering process. However, an increase in the initial particle count significantly escalates computational load, adversely affecting time efficiency. Additionally, the indiscriminate introduction of new particles can infuse the model with fresh uncertainties, impairing its convergence. To address these issues, this study introduces an adaptive strategy for the inclusion of new particles. This strategy leverages the Monte Carlo method to inter-sparse new particles in every filtering iteration, thereby preserving the diversity of the particle ensemble.