# A Resilient Large-Scale Trajectory Index for Cloud-Based Moving Object Applications
## 3 Resilient Moving Object Index
### Prediction Models
#### 3.2.1 Features of the Models  
The features of a model are crucial for making an accurate prediction. After testing and analyzing different direct and derived features, we found that Computation Power Ratio (ComR), Memory Usage Ratio (MemR), and Trajectory Overlapping Indicator (TOver) are the most influential features for our models. All of the selected features depend on the proportionalities between two or more factors, which gives an advantage of not being tied to a specific value or size. Moreover, it reduces the number of features, which might have a negative impact on the regression. The polynomial regression needs to transfer the features into higher-degree ones (polynomial features) based on the polynomial degree. The number of the higher-degree features scale polynomially with respect to the number of the features and exponentially with respect to the degree. By only focusing on the proportional features, we decrease the computational overhead of predicting \(LP\). ComR is computed as follows,  
\[ComR=\frac{tpn}{ExecCoreNum\times ExecNum}\ \, \tag{1}\]  
where \(ExecCoreNum\) is the number of cores with respect to Spark's definitions, and \(ExecNum\) is the number of cluster executors (workers). ComR reflects the computation power of a cluster available to a specific task. As a result, it eliminates the need to specifically report the cluster scale and the data size. MemR reflects the ratio of the used memory by a specific task. It depends on the data size, which we could obtain by using file system calls. However, to speed up the process, RMOI depends only on a sample set (\(ST\)) of trajectories. It estimates the data size based on a segment size and \(ST\):  
\[MemR=\frac{(s^{\prime}/f)\times Seg.Size}{ExecMemSize\times ExecNum}\,\ \ \ \ (0<f\leq 1), \tag{2}\]  
where \(s^{\prime}\) is the number of \(Segs\in ST\) and \(f\) is the sampling fraction. TOver is an indicator that reveals the nature of the trajectories. It is the ratio of the trajectories' MBRs with respect to the global space. For example, a set of sparse trajectories yields a small percentage score on TOver, whereas TOver increases for a compact set of trajectories. TOver is the only feature to capture the differences between trajectory datasets. While the previous features are computed in constant time by plugging in the configuration parameters, TOver needs to scan \(ST\) as follows,\[TOver=\frac{\sum_{i=1}^{m^{\prime}}Traj_{i}.MBR}{m^{\prime}\times ST.MBR}\enspace, \tag{3}\]  
where \(m^{\prime}\) is the number of \(Traj\in ST\). However, the \(ST\) only contains \(Segs\); therefore, it needs to scan \(ST\) first to compute the MBR of each \(Traj\). To keep the complexity linear, we only scan \(ST\) once and use a hash set based on \(Seg.Tid\) to update the MBRs. In addition, it is worth mentioning the relationship between \(\alpha\) and \(\beta\), as they represent the label value for the training data. It is evident that \(\alpha\times\beta=tpn\). Thus, to reveal the performance difference between \(\alpha\) and \(\beta\), we need to fix \(tpn\). Most of the time, the system shows a noticeable change in running time only when we double their values. This is due to the uniform merging of partitions. For example, suppose we have 32 partitions where \(\beta=8\) and \(\alpha=4\). Now, we want to increase \(\beta\), which means decreasing \(\alpha\) to keep the same \(tpn\). Decreasing \(\alpha\) means merging at least two spatial groups (MBRs) into one. However, we do not want to affect only part of the global space. We apply a consistent merging of the spatial groups, which will result in reducing \(\alpha\) by half to 2 and doubling \(\beta\) to 16. On the other hand, using \(\alpha\) or \(\beta\) as a label when training the prediction model will not be smooth because of the doubling in their values. For instance, following the previous example, the possible values for \(\alpha\) or \(\beta\) are 1, 2, 4, 8, 16, or 32. Sometimes, the doubling in the label value affects the regression.