# Detecting Traffic Incidents Using Persistence Diagrams
## 4 Results
Late Evening 5:55 PM-11:55 PM \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Data Set** & **\# Sensors** & **Sensor Locations** & **\# Inc Reported** & **Avg Inc Duration (Min)** \\ \hline Phase 1-Train & 10 & No & 15 & 142 \\ Phase 1-Test & 11 & No & 17 & 159 \\ Phase 2-Train & 10 & Yes & 9 & 96 \\ Phase 2-Test & 8 & Yes & 1409 & 42 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: A summary of the four traffic data sets to which we applied the incident detection algorithm. The windows were ranked by each of their summary statistics within their classification. These rankings were given in the form of a percentile and used as anomaly scores. We expected that traffic patterns throughout the year should be fairly consistent given a particular sensor, day of the week, and period of the day; however, it is possible that traffic behavior could be unusual for an entire day due to a holiday, road construction, or a weather event. Then, according to this window classification, it cannot be readily ascertained if a particular window with a relatively large mean bottleneck distance is due to something acute, such as a traffic incident, or to something predictable, like Labor Day or a major sporting event. We took this into account by reclassifying the windows by sensor, time of day, and day of the year. We then ranked the windows a second time within each of these treatment groups. Each window was assigned 6 percentile scores, based on three different summary statistics each ranked two different ways. We describe our procedure using an example from the Phase 2-Train data. To measure the likelihood that there was an incident occurring near sensor \(p_{0}:=S314402\) on Monday, 6 February 2017, during the window from 7:55 AM to 8:55 AM, we set \(\mathbf{t}_{0}=(7:55,2)\). We apply our algorithm to \(\mathbf{D}_{p_{0},\mathbf{t}_{0}}\). See Figure 3 for an example of the persistence diagrams related to this particular timestamp. If an incident occurred on February 6 th, the sixth Monday of 2017 in the time window classification, we would expect that \(\overline{d}_{p_{0},\mathbf{t}_{0},6}\) would be large compared to the rest of the collection \(\{\overline{d}_{p_{0},\mathbf{t}_{0},6}\}_{w=1}^{52}\). When this is done, we find that \(\overline{d}_{p_{0},\mathbf{t}_{0},6}=41.95\), which is the second largest of the 52 average bottleneck distances in \(\{\overline{d}_{p_{0},\mathbf{t}_{0},w}\}_{w=1}^{52}\). Even though this was not the largest average bottleneck distance observed for this sensor, day of week, and time of day, it did rank above the mid-98 th percentile among all _Mid Day_ windows according to average bottleneck distance for \(S314402\) on a Monday. Similarly, \(s_{p_{0},\mathbf{t}_{0},6}=27.56\) ranked above the 96 th percentile and of standard deviations of bottleneck distance, and \(h_{p_{0},\mathbf{t}_{0},6}=31.16\) ranked just above the 99 th percentile of median bottleneck distances observed from _Mid Day_, Monday windows at sensor \(S314402\). If we consider this window among only the observations from _Mid Day_ on February 6 th at sensor \(S314402\), then \(\overline{d}_{p_{0},\mathbf{t}_{0},6}\) ranks just above the mid-89 th percentile, \(s_{p_{0},\mathbf{t}_{0},6}\) ranks above the mid-90 th percentile, and \(h_{p_{0},\mathbf{t}_{0},6}\) is at least tied as the highest ranking sample median of its class. After the six rankings are determined for each window in our data set, we are ready to apply selection criteria to determine which windows overlapped with traffic incidents. The selection consists of six thresholds for the six rankings. The thresholds are determined by the rankings of windows near the starting times of the labeled incidents in the training data using the procedure outlined below:  
1. Identify all windows starting within 30 min of the timestamp of a reported incident at the same sensor where the incident was located. 2. For each of the 6 types of rankings, identify a minimum ranking needed to include at least one window corresponding to each labeled incident.