## 3 Methodology
### Model Training  
In this research, XGBoost was used to train the model for every bus line. XGBoost is scalable in a wide range of situations because of the optimization of some important algorithms and systems, including a novel tree learning algorithm for handling sparse data and a rational weighted quantile sketch process for controlling instance weights in approximate tree learning. Its operating time is 10 times faster than other popular programs on a single device, and it scales up to billions of examples in the case of distributed or limited memory. Parallel and distributed computing makes learning faster which enables quicker model exploration. In addition, utilization of out-of-core calculation enables hundred millions of examples to be processed on a desktop. These techniques can be connected to create an end-to-end system that extends to big data with the fewest cluster resources. XGBoost is one kind of boosting tree model aiming to generate certain tree models for prediction. The tree ensemble model includes independent variable \(x_{i}\) and dependent variable \(y_{i}\) and estimates the target value \(\overline{y}_{i}\) using \(T\) additive functions. The function can be expressed as  
\[\overline{y}_{i}=\phi(x_{i})=\sum\
olimits_{t=1}^{T}f_{t}(x_{i}) \tag{3}\]  
where \(\overline{y}_{i}\) is the target value; \(y_{i}\) is the dependent variable (\(y_{i}\) is 1 if the passenger boards on or alights from the bus; otherwise, it is 0); \(x_{i}\) is the independent variable; \(t\) is the features; \(f_{t}(x_{i})\) is the model at the \(t\)th iteration and \(T\) is the number of tree functions. The objective is to minimize the loss function \(L^{(t)}\) at the \(t\)th iteration which can be expressed as  
\[L^{(t)}=\sum\
olimits_{i=1}^{n}l\left(y_{i},\overline{y}_{i}^{(t-1)}+f_{t}(x_ {i})\right)+\Omega(f_{t}) \tag{4}\]  
Figure 1: The process and organization of the PFP-XPOI model. where \(l\) represents the loss function and \(\overline{y}_{i}^{(t-1)}\) means the predicted value of the (\(t-1\))th iteration. The additional term \(\Omega(f_{t})\) plays a role in reducing the complexity of the model. Approximating \(L^{(t)}\) with a second-order Taylor expansion for \(l\Big{(}y_{i},\ \overline{y}_{i}^{(t-1)}+f_{t}(x_{i})\Big{)}\) at \(\overline{y}_{i}^{(t-1)}\), the Equation (4) becomes  
\[L^{(t)}\simeq\sum_{i=1}^{n}\left[l\Big{(}y_{i},\overline{y}_{i}^{(t-1)}\Big{)} +g_{i}f_{t}(x_{i})+\frac{1}{2}h_{i}f_{t}^{2}\left(x_{i}\right)\right]+\Omega(f _{t}) \tag{5}\]  
where \(g_{i}=\frac{\partial l\big{(}y_{i},\overline{y}_{i}^{(t-1)}\big{)}}{\partial \overline{y}_{i}^{(t-1)}}\), \(h_{i}=\frac{\partial^{2}l\big{(}y_{i},\overline{y}_{i}^{(t-1)}\big{)}}{ \partial\overline{y}_{i}^{(t-1)}}\). \(l\Big{(}y_{i},\overline{y}_{i}^{(t-1)}\Big{)}\) in Equation (5) can be disregarded as it is a constant term. Therefore, we obtain a new simplified objective function as follows. \[L^{(t)}=\sum_{i=1}^{n}\left[g_{i}f_{t}(x_{i})+\frac{1}{2}h_{i}f_{t}^{2}\left( x_{i}\right)\right]+\Omega(f_{t}) \tag{6}\]  
For a tree structure, the samples can be grouped according to the leaf node, and the samples that fall into the same leaf node can be represented as \(I_{j}=\{i|x_{i}\in j\}\). \(j\) is the leaf node number. By introducing \(w_{j}\) as the score of leaf \(j\), we can rewrite Equation (6) as follows. \[ \begin{array}{l}L^{(t)}=\sum_{i=1}^{n}\left[g_{i}f_{t}(x_{i})+\frac{1}{2}h_{ i}f_{t}^{2}(x_{i})\right]+\gamma T+\frac{1}{2}\lambda\sum_{j=1}^{T}w_{j}^{2} \\ =\sum_{j=1}^{T}l\sum_{j=1}^{T}\left[\left(\sum_{i\in I_{j}}g_{i}\right)w_{j}+ \frac{1}{2}\left(\sum_{i\in I_{j}}h_{i}+\lambda\right)w_{j}^{2}\right]+\gamma T \end{array}  \tag{7}\]  
where \(\gamma\) controls the number of leaf nodes and \(\lambda\) prevents overfitting. Let the value of the first-order partial derivative function of y concerning x be equal to 0, and then the optimal weight \(w_{j}^{*}\) of leaf \(j\) can be calculated as  
\[w_{j}^{*}=-\frac{G_{i}}{H_{i}+\lambda} \tag{8}\]  
\(L^{(t)}\) can finally be shown in Equation (9).