## 3 Methodology
### Random Forest Encounter Prediction Model (RFEPM)  
The RFR operates on the principle of decision trees, enabling decision-making based on specific conditions. Figure 3 illustrates the sample decision trees used to store the mobility histories of three users and predict their future encounters. Figure 3: Encounter prediction by the RFR. Figure 2: Proposed methodology flowchart. For example, [PERSON] mostly visits the cafeteria on certain days and at certain times, followed by the library at a particular time. Similarly, [PERSON] and [PERSON] have their mobility traces stored in the decision tree. Each location visited by the users, along with the corresponding time, is recorded in the decision tree. This separate storage of each spatial-temporal pair of different users facilitates the retrieval of historical data and simplifies encounter predictions [3]. \[r_{j}=\frac{\sum\limits_{j=1}^{n}o_{j}1[u_{j}\in C_{n}(U,E)]}{\sum\limits_{j=1} ^{n}1[u_{j}\in C_{n}(U,E)} \tag{1}\]  
The RFR predicts future encounters by averaging the predicted future location of each user. We begin by selecting parameters suitable for our dataset, which are intended to enhance the accuracy of the RFR. Consider a training sample data input feature, \(F_{n}=(F_{1},F_{2},\dots F_{n})\), where each feature is a random variable taking values in the interval \([0,1]\). We assume that these random variables represent encounters, with \((e\geq 2)\) being the number of encounters, and each pair is independently and identically distributed. For fixed \(u\in[0,\ 1]\), our objective is to estimate the classification function \(r(u)=E[F|u]\) using the feature \(F_{n}\). Formally, a random forest is a predictor that comprises an ensemble of randomized base decision trees, \(r_{n}(u,E_{m},F_{n}),m_{1}\), where \(E_{1},E_{2},\dots\) denote the outputs of a random variable, \(E\). These random trees are generated to form the overall classification estimate. Specifically, we define \(r_{n}(u,F_{n})=E_{E}[r_{n}(u,E,F_{n})]\), where \(E_{E}\) denotes the expectation with respect to the random parameter \(E\), conditional on the user \(u\) and the features of the dataset \(F_{n}\). For simplicity, in the subsequent discussion, we will omit the explicit dependency on the sample and use \(r_{n}(U)\) to denote \(r_{n}(u,F_{n})\). The RFR for encounter prediction consists of random decision trees. Each \(j\)th random tree, \(r_{j}\), utilizes a coordinate, \(U\), and variable, \(E\), to determine the decision rule for partitioning data, as shown in Equation (1). \[u_{n}(U,E)=\sum\limits_{j=1}^{n}O_{j}1[u_{j}\in C_{n}(U,E)] \tag{2}\]  
Here, \(n\) represents the sample size, and \(u_{n}(U,E)\) denotes the time or event that determines the cut points for constructing the new tree, as illustrated in Equation (2). Let \(C_{n}(U,E)\) represent the cell obtained after each random partition. Where \(O_{j}\) is the output of the tree, assume that the data are spread in an Euclidean space and each random tree explores a sub-section of that space. Each tree addresses a specific region of the search space discretely and randomly. The selection of location sub-spaces is also a random process. This random selection of sub-space, when combined with the effect of bagging, enhances overall performance. The performance of each random tree is contingent on the selection of sub-spaces and the subsequent cuts applied in successive steps. \[r_{j}(X)=E_{j}[r_{j}(U,E)] \tag{3}\]  
\[E_{j}=E_{j}\frac{\sum\limits_{j=1}^{n}o_{j}1[u_{j}\in C_{n}(U,E)]}{\sum\limits _{j=1}^{n}1[u_{j}\in C_{n}(U,E)]}1\mu_{n}(^{\omega}U,E^{\omega}) \tag{4}\]  
\[W=\sum\limits_{i=1}^{p}R_{i}(U+E) \tag{5}\]\[MAE=\frac{\sum\limits_{i=1}^{n}|y_{i}-x_{i}|}{n} \tag{6}\]  
Considering the final expectation \(E_{f}\), the estimate for each random tree can be measured using Equation (4). Finally, the correlation among different trees is calculated using Equation (5). Finally, the correlation among different trees is calculated using Equation (5).