# Detecting Traffic Incidents Using Persistence Diagrams
## 1 Introduction
### Description of the Data and Challenge Problem  
The problem we address is to identify incidents in a data set of volumetric traffic counts obtained from multiple inductive loop road sensors, [3], supplied by the California Department of Transportation. The counts were aggregated over 5 min intervals, and we had access to one full calendar year of traffic counts for each sensor. See Table 1 for a sample from the data. We apply our method to this data set in Section 4.  
Our task to identify incidents was part of an anomaly detection problem hosted by the Joint Algorithms for Threat Detection (ATD) and Algorithms for Modern Power Systems (AMPS) Annual Workshop; the challenge problem that we specifically addressed was curated for the ATD program [4]. The challenge problem consisted of two phases: in Phase 1, we were asked to detect incidents within data provided by 10 road sensors that were spatially located to be independent from one another (we were not informed of the locations); in Phase 2, we were asked to repeat Phase 1 provided additional information on the location of the sensors-see Figure 1. For each phase, we were supplied with a training data set and a testing data set with labeled incidents that were hand-selected by the ATD program coordinators. The training data set for Phase 1 contained 9 labeled incidents, and the training data set for Phase 2 contained 10 labeled incidents. There were numerous unlabeled incidents in the training data sets.  
The timeline of the challenge problem was as follows:  
1. Phase 1 training data posted: 15 January 2019
2. Phase 1 testing data posted: 22 March 2019
3. Phase 1 solution deadline: 2 May 2019  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**S312425** & **S312520** & **S312694** & **S312942** & **S314147** & **Timestamp** \\ \hline
45 & 82 & 62 & 102 & 50 & 1/1/2017 0:00 \\
39 & 66 & 60 & 109 & 54 & 1/1/2017 0:05 \\
35 & 92 & 87 & 99 & 80 & 1/1/2017 0:10 \\
67 & 136 & 120 & 111 & 136 & 1/1/2017 0:15 \\
104 & 160 & 148 & 103 & 122 & 1/1/2017 0:20 \\
100 & 141 & 161 & 137 & 159 & 1/1/2017 0:25 \\
110 & 176 & 173 & 150 & 149 & 1/1/2017 0:30 \\
76 & 159 & 157 & 161 & 175 & 1/1/2017 0:35 \\
105 & 166 & 166 & 146 & 188 & 1/1/2017 0:40 \\
93 & 176 & 143 & 172 & 157 & 1/1/2017 0:45 \\
127 & 168 & 152 & 194 & 133 & 1/1/2017 0:50 \\
137 & 171 & 174 & 187 & 169 & 1/1/2017 0:55 \\ \hline \hline \end{tabular}
\end{table}
Table 1: A sample of the traffic counts from Phase 1-Train.  
Figure 1: A map of sensor locations from Phase 2-Train.  
Phase 2 training data posted: 24 May 2019
* 5 Phase 2 testing data posted: 15 July 2019
* 6 Phase 2 solution deadline: 27 September 2019  
Supplementary materials in the form of data sets and code are available at the following repository: [[https://bitbucket.org/esweber/randomized-persistence-landscapes/src/master/](https://bitbucket.org/esweber/randomized-persistence-landscapes/src/master/)]([https://bitbucket.org/esweber/randomized-persistence-landscapes/src/master/](https://bitbucket.org/esweber/randomized-persistence-landscapes/src/master/)).  
Data sets for the challenge problem were originally released as files in MATLAB. We have converted the data to comma-separated values files and all experiments discussed in the paper can be reproduced by executing our code in R-Studio. Our solutions were submitted as a binary output for each 5 min interval with 1 indicating an incident and 0 otherwise. Three evaluation metrics were then used to evaluate the performance of our algorithm: precision, recall, and an F-score.