# Research on Distributed Fault Diagnosis Model of Elevator Based on PCA-LSTM
## 2 PCA-LSTM Based Fault Prediction Model
### Introduction to Principal Component Analysis (PCA)
\[x_{i,j}^{*}=\left(x_{i,j}-\overline{x_{i}}\right)/\sqrt{S_{i}} \tag{2}\]  
Among them is the following:  
\[\overline{x_{i}}=\frac{1}{n}\sum_{j=1}^{n}x_{ji}\,i=1,2,\ldots,n \tag{3}\]  
\[S_{i}=\frac{1}{n-1\sum_{j=1}^{n}\left(x_{ji}-\overline{x_{i}}\right)^{2}},i=1,2,\ldots,n \tag{4}\]  
Step 2. Find the covariance matrix, \(R\). The covariance matrix is given by \(R=\frac{1}{n-1}X^{T}X\). The computed covariance matrix is an eigen m \(\times\) m dimensional matrix. Step 3. Find eigenvalues and eigenvectors. Find the eigenvalues and eigenvectors of the covariance matrix \(R\), and arrange the eigenvalues from smallest to largest. \[\lambda_{1}\geq\lambda_{2}\geq\lambda_{3}\ldots\geq\lambda_{m} \tag{5}\]  
The eigenvectors are obtained by rearranging them according to their eigenvalues: \(P_{mm}=[p_{1},p_{2},\ldots,p_{m}]\). Step 4. Select appropriate \(k\) features for PCA down-scaling. In this study, the top \(k\) features with cumulative feature values greater than 85% were selected for PCA dimensionality reduction. \[\sum_{i=1}^{k}\lambda_{i}/\sum_{i=1}^{m}\lambda_{i}\geq 0.85 \tag{6}\]  
Figure 1 illustrates the proportion of variance explained by each principal component within the dataset derived from elevator experiments, demonstrating the rationale for adopting 85% as the threshold. The y-axis represents the percentage of the total variance explained by all principal components, while the x-axis indicates the sequentially numbered principal components. The stepwise blue line indicates the cumulative variance explained by the principal components as we progress from left to right (from the first to the last principal component). Each upward step signifies an increment in the total variance explained upon the inclusion of that component. The dashed red line across the graph marks the threshold of 85% cumulative explained variance. The point where this line intersects with the step curve (cumulative explained variance) signifies the minimum number of principal components necessary to explain at least 85% of the total variance. In  
this particular example, the intersection occurs at the 15 th principal component (PC15), as annotated on the plot. This indicates that the first 15 principal components together explain 85% of the total variance. Hence, retaining these 15 components would capture the majority of the information present in the dataset while excluding the remaining components that contribute less significantly to the variance, which likely represent noise or less informative aspects of the data. Therefore, selecting components that encompass 85% of the variance is a justified approach, as it ensures the comprehensive capturing of the data structure while also reducing complexity and the potential for overfitting. It strikes a balance between information retention and computational efficiency. Let the first \(k\) eigenvalues from largest to smallest form a diagonal matrix and the \(k\) corresponding eigenvectors form a descending matrix. That is,  
\[S_{kk}=diag(\lambda_{1},\lambda_{2},\ldots,\lambda_{k}) \tag{7}\]  
\[P_{mk}=[p_{1},p_{2},\ldots,p_{k}] \tag{8}\]  
After the PCA dimensionality reduction, the number of elevator samples is still \(n\), but the number of features becomes \(k\), and the dimensionality reduction formula is  
\[\widetilde{X}_{nk}=X_{nm}*P_{mk} \tag{9}\]  
The reconstruction of \(X\) to obtain the \(X^{\prime}\) of the matrix is given by the formula  
\[X^{\prime}=\widetilde{X}_{nk}P_{mk}^{T}=X_{nm}*P_{mk}P_{mk}^{T} \tag{10}\]  
Based on the above calculations, it is known that PCA not only reduces the number of subsequent calculations but also improves overall performance.