# ECC: Passenger Counting in the Elevator Using Commodity WiFi
## 3 Materials and Methods
### Sub-Carrier Decorrelation by SLD-PCA  
A single antenna pair provides 30 streams of CSI from 30 sub-carriers, and they are mostly correlated. However, for time-frequency analysis, as few streams as possible are required to reduce the computational overhead in constructing the spectrogram for feature extraction [30]. Traditional principal component analysis (PCA) [31] uses the same method to deal with adjacent data and non-adjacent data, which makes it impossible to discover the local structure of the data in a short time. Hence, this paper proposes an SLD-PCA algorithm to decorrelate the CSI streams.  
SLD-PCA combines the local preservation idea of the locality preserving projection (LPP) method and adopts different processing methods for the adjacent and non-adjacent data in the data. It separates the non-adjacent data as much as possible in the projection space while keeping the original adjacent relationship for the data. If the initial data matrix is \(x=(x_{1},x_{2},\ldots,x_{N})\), and the matrix after projection is \(y=(y_{1},y_{2},\ldots,y_{N})\). Then, the following constraint conditions are added to the original optimization function:  
\[\left\{\begin{array}{l}\max\sum_{i,j=1}^{N}||y_{i}-y_{j}||G_{ij}^{\prime},\\ s\cdot t\cdot\sum_{i,j=1}^{N}||y_{i}-y_{j}||^{2}G_{ij}=1\end{array}\right. \tag{8}\]  
where \(N\) is the length of CSI, the weight \(G_{ij}^{\prime}=1\) if the data \(x_{i}\) and \(x_{j}\) are non-adjacent points; otherwise \(G_{ij}^{\prime}=0\). The weight \(G_{ij}=e^{-\left\|x_{i}-x_{j}\right\|^{2}/\xi}\), and \(\xi\) is an adjustable parameter. \(G_{ij}=0\) represents \(x_{i}\) and \(x_{j}\) are non-adjacent points. The smaller the distance between adjacent points \(x_{i}\) and \(x_{j}\) in the high-dimensional space, the larger the value of \(G_{ij}\). According to the equality constraint, the distance between their corresponding low-dimensional space projections \(y_{i}\) and \(y_{j}\) is smaller. The equality constraints mean that when the closer points in the high-dimensional space are projected into the low-dimensional space, they keep a relatively close distance, so the local structure of data is preserved.  
After SLD-PCA, the data are converted from the original coordinate system to the new coordinate system, and the PCs are extracted. However, most of the variances are in the first few coordinates in the order, while the other few are almost zeros in the subsequent coordinates [32]. Its meaning is to retain only the feature dimensions that contain most of the variances while ignoring the dimensions where the variances are almost zero to reduce the dimensionality of the feature data. Hence, the number of PCs is selected by calculating the capture variance (CAV):  
\[\text{CAV}=\frac{\text{CUM of selected PCs}}{\text{CUM of all 30 sub-carriers}}\geq 95\% \tag{9}\]  
where CUM is the cumulative variance. Figure 4 shows the results of PC's selection for 4 and 6 persons. The results prove that the main variation of the CSI concentrates on the first 3 and 2 PCs. Moreover, the number of PCs is not the same under the different cases, and there is no monotonous relationship between the number of people and the number of PCs. It is because the human factor will cause the different reflection of CSI. The results also show that the noise level begins to increase as the number of PCs increases. Hence, the signal de-noising on each PC is required.