# A Spatial-Temporal-Semantic Neural Network Algorithm for Location Prediction on Moving Objects
## 4 Experiments
### Experimental Preparation
#### 4.1.2 Evaluation Metrics  
Trajectories are consist of track points that are continuous in space and time. Before to using prediction models, each of the points should be transformed into discrete codes associated to specific regions. This is done so that the learning of models can be done more efficiently and the prediction result can be more precisely. Traditional cell-based methods such as the Geohash convert points into grids. The proposed STS feature extraction utilizes a more accurate way to map each track point to the fixed point on the nearest road. Both methods will cause approximation errors between the original points and the representative points. The average sphere distance between the original points and the representative points is called the deviation distance, as shown in Figure 17. The deviation distance of Geohash is the average distance between each track point and the central point of the grid. The deviation distance of the STS is the average distance between each track point and the fixed point on the nearest road. The deviation distance is used to evaluate the performance of the STS feature extraction method.  
In order to measure the performances of different methods, several evaluation metrics are used, including precision, recall, and F-score. The problem of location prediction can be defined as the classification problem. The prediction model predicts the location ID with the highest probability among all location IDs that the object may visit. For classification problems, the samples can be divided  
Figure 17: The calculation of deviation distance. (**a**) The deviation distance of the Geohash. (**b**) The deviation distance of the STS feature extraction.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Dataset** & **Days** & **Trajs** & **AvgPts/tra** & **AvgPts/day** & **AvgRate (Hz)** & **AvgDis/pt (m)** & **AvgDis/day (km)** \\ \hline Courier & 66 & 198 & 582 & 1746 & 0.5 & 3.5 & 6.1 \\ MTabus & 90 & 149 & 710 & 1176 & 0.03 & 82.3 & 58.4 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Statistics of two trajectory datasets.  
into four categories, namely true positives, true negatives, false positives, and false negatives, which are shown in Table 4.  
The precision is the fraction of retrieved documents that are relevant to the query. The recall is the fraction of the documents that are relevant to the query that are successfully retrieved, as shown in Equations (14) and (15). For example, if the historical movements of the object shows that there are total of five locations (ID 1 to 5). Four location sequences are going to be predicted and the truth of the next location is (\(1,1,3,5\)). The result given by the model is (\(1,2,1,5\)). For location \(1\), \(TP=1\), \(FP=1\), \(TN=1\), \(FN=1\). Thus, the precision and recall are 0.5, respectively. Usually, the average precision and recall for all locations are calculated. Moreover, in order to measure the overall performance of the model, F-score is considered, which contains both the precision and the recall, as shown in Equation (16).  
\[Precision=\frac{TP}{TP+FP} \tag{14}\]  
\[Recall=\frac{TP}{TP+FN} \tag{15}\]  
\[F-score=\frac{2\cdot Precision\cdot Recall}{Precision+Recall}. \tag{16}\]