# Statistical Analysis on Random Matrices of Echo State Network in PEMFC System's Lifetime Prediction
## 2 Mathematical Backgrounds
### Implementation of Ensemble ESN  
The implementation process of the ensemble ESN is shown in Figure 2. There are four steps in total:  
Step 1 is the training data preparation. Some pretreatment procedures are necessary, such as filtering, resampling, and normalization after the data (voltage, current, etc.) acquisition. In this task, the moving average filtering method is utilized, and the length of the moving window is empirically set to 31. The resampling time interval between two adjacent points is 0.5 h. The data are normalized to the same interval [0, 1] by Equation (7)  
\[z^{\prime}=\frac{z-z_{\text{min}}}{z_{\text{max}}-z_{\text{min}}} \tag{7}\]  
where \(z^{\prime}\) is the normalized value, \(z\) is the original value, and \(z_{\text{max}}\) and \(z_{\text{min}}\) are the maximum and minimum values, respectively. The health indicators can be extracted, i.e., voltage for steady-state and quasi-dynamic operating conditions and the relative power loss rate (RPLR) for the dynamic operating condition.  
Step 2 is the degradation prediction based on individual ESNs. The randomly generated procedure of \(\textbf{W}_{in}\) and **W** are similar in the ESN, so the distribution shapes of these two matrices are the same for convenience. For each ESN\({}_{i}\) (\(1\leq i\leq p\)), the uniform distribution and Gaussian distribution shapes of these two matrices are explored separately. The hyperparameters of the ESN are optimized by PSO in the training part, and the optimized parameter combination is used in the prediction part. Thus, each ESN would have two long-term prediction results under two random matrices distribution shapes. The total number of ensemble ESNs is set to be 100 (\(p\) = 100) for statistical analysis.  
Step 3 is the ensemble of prediction results. For a certain distribution shape, 100 times prediction results are assembled to form a single new model to statistically analyze the randomness. The weight of each ESN is taken to be the same, i.e., each ESN has the same contribution during the RUL prediction. Thus, the mean value of 100 ESNs at each time is calculated as the final prediction value.  
Step 4 is the result analysis. Each ESN could realize an individual prediction, and its RMSE between the predicted signal and target signal can be calculated by  
\[\text{RMSE}=\sqrt{\frac{1}{m}\sum_{t=1}^{m}\left(\textbf{y}^{pre}(t)-\textbf{ y}^{tar}(t)\right)^{2}} \tag{8}\]  
Figure 2: The implementation process of ensemble ESN.  
At a certain time step \(t\) (\(1\leq t\leq m\)), the mean and the variance of the predicted value at time step (\(s+t\)) can be represented as  
\[\left\{\begin{array}{l}\overline{y}\left(s+t\right)=\frac{1}{\hat{p}}\sum \limits_{i=1}^{p}\hat{y}_{i}\left(s+t\right)\\ D(s+t)=\frac{1}{p-1}\sum\limits_{i=1}^{p}\left(\overline{y}\left(s+t\right)- \hat{y}_{i}\left(s+t\right)\right)^{2}\end{array}\right. \tag{9}\]  
where \(p\) is the total number of ensemble ESNs, \(\hat{y}_{i}(s+t)\) is the predicted value, \(\overline{y}(s+t)\) is mean value, and \(D(s+t)\) is the variance. Assuming the predicted value follows the standard Gaussian distribution, the 95% confidence interval (CI) of the results at time step (\(s+t\)) can be expressed as  
\[\text{CI}(s+t)=\ \left[\overline{y}\left(s+t\right)-1.96\sqrt{D(s+t)},\overline{y }\left(s+t\right)+1.96\sqrt{D(s+t)}\right] \tag{10}\]