# Compressible Diagnosis of Membrane Fouling Based on Transfer Entropy
## 3 Methodology
### Feature Variable Selection  
In this part, the advantages of the linear regression algorithm and the typical PLS are integrated. Hence, the characteristic variables that have a great impact on membrane fouling detection can be selected. To be specific, the PLS algorithm is adopted in this study and the steps are as follows:  
1. The data of the independent variable is given as \(\mathbf{P}=[\mathbf{p}_{1},\,\mathbf{p}_{2},\,\ldots,\,\mathbf{p}_{j}]\), \(\mathbf{p}_{j}\)\(=(p_{1j},\,p_{2j},\,\ldots,\,p_{jj})^{\mathrm{T}}\), \(i=1,\,2,\,\ldots,\,m,j=1,\,2,\,\ldots,\,n\), and the dependent variable \(\mathbf{Q}=[q_{1},\,q_{2},\,\ldots,\,q_{i}]^{\mathrm{T}}\). The standard treatment is as follows: \[\left\{\begin{array}{l}p_{ij}^{\prime}=\frac{p_{ij}-\overline{p}_{j}}{s_{j}} \\ q_{i}^{\prime}=\frac{q_{i}-\overline{q}}{s}\end{array}\right.,\] (1) where the standardized \(\mathbf{P}\) and \(\mathbf{Q}\) are recorded as \(\mathbf{E}_{0}\) and \(\mathbf{F}_{0}\). \(p_{ij}^{\prime}\) and \(q_{i}^{\prime}\) represent the elements in \(\mathbf{E}_{0}\) and \(\mathbf{F}_{0}\), respectively. \(\overline{p}_{j}\) and \(s_{j}\) represent the average value and standard deviation of the elements in column \(j\) of \(\mathbf{P}\), respectively. \(\overline{q}\) and \(s\) represent the average value and standard deviation of all elements in \(\mathbf{Q}\), respectively. \(\overline{p}_{j}\) and \(\overline{q}\) can be expressed by \[\left\{\begin{array}{l}\overline{p}_{j}=\frac{1}{m}\sum\limits_{i=1}^{m}p_{ ij},s_{j}=\sqrt{\frac{1}{m-1}\sum\limits_{i=1}^{m}\left(p_{ij}-\overline{p}_{j} \right)^{2}}\\ \overline{q}=\frac{1}{m}\sum\limits_{i=1}^{m}q_{i},s=\sqrt{\frac{1}{m-1}\sum \limits_{i=1}^{m}\left(q_{i}-\overline{q}\right)^{2}}\end{array}\right..\] (2)
2. The principal component of the variable is found via the following formula: \[\left\{\begin{array}{l}\mathbf{a}_{h}=\mathbf{E}_{h-1}^{\mathrm{T}}\mathbf{ F}_{0}/\left\|\mathbf{E}_{h-1}^{\mathrm{T}}\mathbf{F}_{0}\right\|^{2}\\ \mathbf{v}_{h}=\mathbf{E}_{h-1}\mathbf{a}_{h}\\ \mathbf{b}_{h}=\mathbf{E}_{h-1}^{\mathrm{T}}\mathbf{v}_{h}/\left\|\mathbf{v}_ {h}\right\|^{2}\\ \mathbf{r}_{h}=\mathbf{E}_{h-1}^{\mathrm{T}}\mathbf{v}_{h}/\left\|\mathbf{v}_ {h}\right\|^{2}\\ \mathbf{E}_{h}=\mathbf{E}_{h-1}-\mathbf{v}_{h}\mathbf{b}_{h}\end{array}\right.,\] (3) where \(h\) is the number of extracted principal components. \(\mathbf{E}_{h}\) is the standardized independent variable matrix when \(h\) components are extracted. \(\mathbf{F}_{h}\) is the standardized dependent variable matrix when \(h\) components are extracted. \(\mathbf{v}_{h}\) is the component extracted from \(\mathbf{E}_{h-1}\). \(\mathbf{a}_{h}\), \(\mathbf{b}_{h}\) and \(\mathbf{r}_{h}\) represent the intermediate vectors.
3. The cross-validity \(Q_{h}^{2}\) is used to determine the number of final extracted components with \[Q_{h}^{2}=1-L(h)/LL(h-1),\] (4) where \(L(h)\) and \(LL(h)\) can be expressed by \[L(h)=\sum\limits_{d=1}^{m}\left(q_{d}^{\prime}-\tilde{q}_{h(-d)}^{\prime} \right)^{2},LL(h)=\sum\limits_{d=1}^{m}\left(q_{d}^{\prime}-\tilde{q}_{h(d)}^{ \prime}\right)^{2},\] (5) where \(qobtain coefficients \(\zeta_{i}\). Finally, the fitting value of the \(d\)th sample point is calculated and recorded as \(\hat{q}_{h(d)}^{\prime}\).  
In the process of extracting components, when \(Q_{k+1}^{2}<0.0975\) and the model accuracy reaches the expected requirements, the process of extracting components stops. The number of extracted principal components is \(m\). And the feature variables are represented as \(\mathbf{X}=[x_{1},x_{2},\ldots,x_{m}]\).