## 3 Dataset Generation  
### Basic Traffic Dataset  
The data used in this study were established using three sources. The first source was the traffic flow data of National Freeway No. 1. This highway connects northern and southern Taiwan and is therefore crucial to national economic development. A VD is installed every 2 km along the highway, and ETC gantries are installed at each interchange. Data collected from ETC and VD devices are analyzed by traffic controllers to formulate adequate traffic control strategies. For this study, the 2021 ETC and VD data of National Freeway No. 1 were downloaded from the database of the Freeway Bureau of Taiwan, which contains 210,240 records of the mean travel time, mean speed, quantity, occupancy rate, and toll of each vehicle type. After negative speed, negative traffic flow, and other irrelevant data were excluded, an average of 14 million data entries were generated for the basic traffic dataset each day.  
The following methods were used to generate essential data for the basic traffic dataset:  
1. Traffic flow volume: Depending on ETC and VD data, the number of vehicles passing through two neighboring gantries was calculated for each vehicle type. The results were then converted into passenger car equivalents in accordance with the road capacity manual published by the Taiwanese government. ([[https://thcs.iot.gov.tw/WebForm3.aspx#gsc.tab=0](https://thcs.iot.gov.tw/WebForm3.aspx#gsc.tab=0)]([https://thcs.iot.gov.tw/WebForm3.aspx#gsc.tab=0](https://thcs.iot.gov.tw/WebForm3.aspx#gsc.tab=0)), accessed on 15 November 2022).
2. Mean speed: Mean speed is pointed to every 5 min between adjacent ETC gantry through all average vehicle speed detection (\(mean\_speed_{t}^{l}=\sum_{i}speed_{t}^{l}/veh\)). Where \(speed_{t}^{l}\) is the speed detected by the \(i\)th car at time \(t\). _veh_ is the total number of vehicles detected in five minutes. In addition, \(t\) is the time index, which distinguishes the time interval of every 5 min.
3. Mean speed difference: Depending on ETC and VD data, the mean speed differences of all vehicles passing through a gantry were calculated as follows: \(mean\_speed\_diff_{t}^{l}=mean\_speed_{t}^{l}-mean\_speed_{t-1}^{l}\), where \(l\) is a gantry label, \(t\) is a time label, \(speed\_diff_{t}^{l}\) is the mean traffic speed difference of gantry \(l\) at time \(t\), \(mean\_speed_{t}^{l}\) is the traffic speed of gantry \(l\) at time \(t\), and \(mean\_speed_{t-1}^{l}\) is the traffic speed of gantry \(l\) at time \(t-1\).
4. Mean passing time: Depending on daily ETC data, the durations spent by all vehicles passing through two neighboring gantries were summed every 5 min and averaged to determine the mean travel time. The following equation was used: \(ave\_passtime_{t}=\frac{\sum_{veh}\mathit{pusttime}_{veh}^{veh}}{veh}\), where \(passtime_{t}^{veh}\) is the travel time of each vehicle passing through two neighboring gantries at time \(t\) and _veh_ is the number of vehicles passing through the gantries within 5 min.
5. Lane occupancy: Depending on VD data, the identification code of each VD was acquired to determine the lane occupancy rate at each VD location. This rate was calculated every 5 min, and its association with that at each ETC gantry was determined to derive the occupancy of each lane between every two neighboring gantries.
6. Number of accidents: The associations between gantry location and accident number (were determined to identify the distribution of accidents at each gantry.)