# Predicting the External Corrosion Rate of Buried Pipelines Using a Novel Soft Modeling Technique
## 2 Materials and Methods  
### KPCA Algorithm  
The kernel principal component analysis (KPCA) algorithm improves upon the principal component analysis (PCA) method. It is particularly suitable for dealing with nonlinear problems. The traditional PCA algorithm performs poorly in dealing with nonlinear data [40]. Therefore, scholars combined the PCA algorithm with the kernel function and proposed the KPCA algorithm. KPCA extends PCA's application from linear domains to nonlinear domains. This measure allows for better handling of nonlinear data and improves the generalization of models [41]. It realizes this function by using nonlinear project functions. This function inputs the original data into a feature space through a spatial project threshold. In the feature vector space, KPCA then realizes the linear dimensionality reduction in PCA [42]. The KPCA algorithm flow chart is shown in Figure 1.  
Consider the input space dataset \(X=\left\{x_{1},\ \ x_{2},\ \ldots,\ \ x_{m}\right\}\in R^{d}\) and the high-dimensional feature space \(F\), e a non-linear function of \(\Phi(x)\). Then,  
\[\Phi:R^{d}\to F_{i}x\rightarrow\eta=\Phi(x) \tag{1}\]  
Figure 1: Flowchart of the KPCA algorithm. If \(\sum\Phi(x)=0\), then the covariance matrix of \(F\) can be expressed as:  
\[C^{F}=\frac{1}{m}\sum_{j=1}^{m}\Phi\big{(}x_{j}\big{)}\Phi\big{(}x_{j}\big{)}^{T} \tag{2}\]  
Let be the eigenvalue of \(C^{F}\) and be the eigenvector of \(C^{F}\), where \(\lambda\geq 0\). Then, \(\lambda\) and \(\eta\) satisfy the following condition:  
\[C^{F}\eta=\lambda\eta \tag{3}\]  
Multiplying both sides of Equation (3) by \(\Phi\big{(}x_{\eta}\big{)}\), we have the following:  
\[\Big{(}\Phi\big{(}x_{\eta}\big{)}\cdot C^{F}\eta\Big{)}=\lambda\big{(}\Phi \big{(}x_{\eta}\big{)}\cdot\eta\big{)} \tag{4}\]  
According to the kernel reproducing theory, the eigenvalue \(\lambda\) can be linearly represented by \(\Phi(x_{i})\) as follows:  
\[\eta=\sum_{i=1}^{m}\alpha_{i}\Phi(x_{i}) \tag{5}\]  
where \(\alpha_{i}\) is the weight of \(\Phi(x_{i})\). Substituting Equations (3) and (5) into Equation (4), we obtain the following:  
\[\lambda\Bigg{(}\Phi\big{(}x_{\eta}\big{)}\cdot\sum_{i=1}^{m}\alpha_{i}\Phi(x_{ i})\Bigg{)}=\Bigg{(}\Phi\big{(}x_{\eta}\big{)}\cdot\frac{1}{m}\sum_{j=1}^{m} \Phi\big{(}x_{j}\big{)}\Phi\big{(}x_{j}\big{)}^{T}\sum_{i=1}^{m}\alpha_{i}\Phi (x_{i})\Bigg{)} \tag{6}\]  
Define an \(M\times M\) matrix \(K\) as follows:  
\[K_{i\eta}=\big{(}\Phi(x_{i})\Phi\big{(}x_{\eta}\big{)}\big{)} \tag{7}\]  
Equation (7) can be simplified as follows:  
\[m\lambda K\alpha=K^{2}\alpha \tag{8}\]  
It is obvious that:  
\[\Phi:R^{d}\to F_{i}x\rightarrow\eta=\Phi(x) \tag{1}\]0  
By solving Equation (9), we obtain the corresponding eigenvalues and eigenvectors of the high-dimensional feature space \(F\). Consequently, we can derive the \(k\) principal component projections of the input sample \(X\) in the feature space. \[\Phi:R^{d}\to F_{i}x\rightarrow\eta=\Phi(x) \tag{1}\]1  
The \(k\) principal component vector is obtained by substituting the kernel function for the inner product in the expression. \[\Phi:R^{d}\to F_{i}x\rightarrow\eta=\Phi(x) \tag{1}\]2  
In practice, it is difficult to satisfy the condition \(\sum\Phi(x)=0\). Therefore, it is necessary to modify the kernel matrix \(K\) to \(\overline{K}\), as shown below:  
\[\Phi:R^{d}\to F_{i}x\rightarrow\eta=\Phi(x) \tag{1}\]3  
The implementation process of the KPCA algorithm is as follows:Step 1: Process the original data samples \(X\) for the external corrosion prediction of a buried pipeline, and generate an \(M\times N\) data matrix \(A\). Step 2: Select the Gaussian function as the kernel function with preset parameters, and calculate the kernel matrix \(K\) according to \(K_{wl}=K(x_{w},x_{l})=\Phi(x_{w})^{T}\Phi(x_{l})\). Step 3: Modify the kernel function to obtain a new kernel matrix \(\overline{K}\). Step 4: Calculate the eigenvalue \(\lambda_{1},\lambda_{2},\cdots,\lambda_{m}\) and eigenvector \(\eta_{1},\eta_{2},\cdots\)\(\eta_{m}\) of \(\overline{K}\).