# Device-Free Crowd Size Estimation Using Wireless Sensing on Subway Platforms
## 4 Materials and Methods
### Crowd Size Estimation  
The main goal of our application is to obtain an accurate estimate regarding the number of people present on the platform. Previous research [10; 11] has demonstrated that a linear or polynomial relationship can be obtained between the mean measured attenuation within a stable environment and the number of people present. This relationship, once learned by a model, can be utilized to calculate the real-time number of people present from the measured mean attenuation. However, when a rail vehicle is introduced into the environment, it obstructs the LoS of links, causing shadow fading as well as changing the reflection paths. This change in reflections results in significant changes in constructive and destructive interference called multipath fading. The fading caused by the rail vehicle is significant enough to alter the relationship between the mean attenuation and people count. This change in relationship causes the model to become unreliable for making accurate predictions of people count. In order to compensate for the changed environment, we split the model for crowd size estimation into two separate models: one model for use when the obstruction (rail vehicle) is not present and one for the situation when the obstruction is present. To demonstrate this hypothesis, we compare the Pearson correlation coefficients and Spearman's rank correlation coefficients of the training set's ground truth and the corresponding attenuation values of the full set, as well as for separated sets. We do so for scenarios both with and without a vehicle present. The results are shown in Table 1. Both the Pearson correlation coefficients and Spearman's rank correlation coefficients show improvements when splitting the training set based on the presence of a rail vehicle. To calculate these correlations, we only used the data collected during the day, as these data have a more even distribution over different crowd densities. This improves the reliability of the resulting correlation coefficients. The improvement in the Pearson correlation coefficients indicates an increase in linearity when splitting the dataset, while [PERSON]'s rank correlation coefficients indicate an increase in monotonicity. The model used when no rail vehicle is present uses the measured attenuation values from the virtual sensor network containing all nodes, as described in Section 3. We trained the model on the collected training data when no vehicle was present in the environment. The model used when a rail vehicle is present uses the nodes mounted on the ceiling and the platform wall and was trained on the data collected when a vehicle was present. The regression model we used for both models is a polynomial regression model, as depicted in Equation (2). Similar to the model used for vehicle detection, we use the arithmetic mean attenuation (in dB) of the links in the virtual sensor network \(\mathbf{\hat{a}}\) as an input variable. \(w_{2}\), \(w_{1}\), and \(b\) are the parameters of the model, namely, the curvature (or 2 nd-order weight), slope (or 1 st-order weight), and intercept (or bias), respectively. The output variable \(\hat{p}\) represents the predicted number of people present in the environment. \[\hat{p}=w_{2}\mathbf{\hat{a}}^{2}+w_{1}\mathbf{\hat{a}}+b \tag{2}\]  
Similar to the logistic regression model discussed before, this model was implemented using the _LinearRegression_ and _PolynomialFeatures_ classes provided by the scikit-learn Python library [26], which provide an established implementation for the linear regression model and polynomial feature transformation, respectively. The ground-truth people counts used for training the crowd size estimation models were manually collected together with the vehicle detection data. The samples that were collected contain the manually counted number of people present together with the timestamp of submission.