# DeepST-Net: Leveraging Spatiotemporal Data Refinement for Enhanced Travel Time Prediction
## 4 The Proposed Framework for Travel Time Prediction
### Spatiotemporal Data Refinement and Categorization
#### 4.1.4 Temporal Clustering  
Temporal clustering is a powerful technique for analyzing time-varying data and identifying patterns and trends within complex systems. It groups data based on temporal features, allowing us to gain insights into phenomena such as rush hour, congestion patterns, and seasonal variations. In our study, we applied temporal clustering at different time scales--daily, weekly, and yearly--enabling us to examine patterns and trends at various levels of granularity.  
* **Short-term trends (daily):** By examining the data at a daily time scale, we aimed to uncover patterns such as peak hours and daily variations. This analysis helped us understand the temporal dynamics of travel patterns within a typical day.
* **Long-term trends (weekly, yearly):** To capture seasonal variations and trends over longer periods, we expanded our analysis to weekly and yearly time scales. This allowed us to identify patterns that emerge over weeks and years, providing valuable insights into the long-term dynamics of travel behavior.  
For the temporal clustering process, we utilized the Density-Based Spatial Clustering of Applications with Noise (DBSCAN) algorithm. DBSCAN is a widely-used clustering algorithm in data mining and machine learning that identifies clusters of densely packed data points while distinguishing them from less densely packed or isolated points [41].  
We divided the timestamp into the following three time scales: hour (0-23), day of the week (Monday-Sunday), and month (0-11). We then counted the occurrences of each time value within the entire dataset. By applying the DBSCAN algorithm to these time features, we identified clusters that represent distinct temporal patterns. To optimize the clustering performance, we determined the optimal values for the DBSCAN parameters (minimum samples and epsilon) using the Nearest Neighbors algorithm. This ensured an accurate representation of the temporal patterns in the data. The resulting clusters for different time scales (daily, weekly, and yearly) are visualized in Figure 6, with each cluster represented by a unique color scheme.  
The figure provides valuable insights into the temporal patterns of travel behavior. We observe that daily peak hours occur in the late afternoon and early evening, coinciding with the end of the workday when individuals are likely to be commuting or running errands. Additionally, weekends exhibit higher travel activity, indicating leisure trips and visits to family and friends. These patterns align with human behavior, where individuals tend to travel during their free time and when they have completed their daily tasks.  
Moreover, our analysis identified certain months that experience increased traffic levels. The summer tourist season, spanning from June to August, contributes significantly to the surge in travel during these months. Additionally, December shows heightened traffic due to holiday shopping and increased tourism. Furthermore, increased traffic is observed in March and April, possibly attributed to the influx of visitors during the spring break and Easter holidays.