<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>AAAI Conference on Artificial Intelligence
[</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.48550/arxiv</article-id>
      <title-group>
        <article-title>Real-Time Spatio-Temporal Forecasting with Dynamic Urban Event and Vehicle-Level Flow Information⋆</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Chris Conlan</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Joe Oakley</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gunduz Vehbi Demirci</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alexandros Sfyridis</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hakan Ferhatosmanoglu</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Imagination Technologies</institution>
          ,
          <addr-line>London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Imperial College London</institution>
          ,
          <addr-line>London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Warwick</institution>
          ,
          <addr-line>Coventry</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2013</year>
      </pub-date>
      <volume>33</volume>
      <issue>2019</issue>
      <fpage>448</fpage>
      <lpage>453</lpage>
      <abstract>
        <p>Building a real-time spatio-temporal forecasting system is a challenging problem which has many practical applications such as trafic and road network management. Most forecasting research typically focuses on the average quality of predictive models, with much less attention paid to building a practical pipeline and achieving timely and accurate forecasts when the network is under heavy load. Additionally, transport authorities face the issue of how to efectively leverage various dynamic data sources, such as urban events (e.g., scheduled roadworks on the road network, cultural events) and vehicle-level flow data. In this paper, we investigate the practical challenges of real-time forecasting, and present Foresight, a cloud-based system for spatio-temporal forecasting developed in collaboration with Transport for the West Midlands (TfWM). Foresight can ingest, aggregate and process streamed trafic data to produce road network forecasts continuously. We adapt spatio-temporal machine learning methods to incorporate dynamic urban events and vehicle-level flow data, and experimentally evaluate a variety of predictive models in our setting. We employ a data-driven approach to identify peak times in the network, and provide insights on how the performance of forecasting solutions varies for these times when accurate forecasts are most important. We observe that incorporating roadworks into a Graph Neural Network (GNN) model can provide up to a 29.1% performance improvement (MAPE) at a 60-minute forecasting horizon. Further, modelling trafic propagation using vehicle-level flow data in order to support graph-based learning can yield performance gains of 8.8% (MAE) at peak times.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Real-Time Trafic Forecasting</kwd>
        <kwd>Deep Learning</kwd>
        <kwd>Graph Neural Networks</kwd>
        <kwd>Dynamic Urban Events</kwd>
        <kwd>Roadworks Data</kwd>
        <kwd>Flow Information</kwd>
        <kwd>Peak Trafic Conditions</kwd>
        <kwd>Streaming Data</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        ods such as ARIMA [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], to Deep Learning (DL) models
such as LSTM [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In recent years, Graph Neural
NetTrafic data collected at roadside sensors can ofer sig- work (GNN) approaches have achieved state-of-the-art
nificant value to transport managers. The raw data is results, due to their ability to capture spatial
dependentypically transformed into a time series format, captur- cies between sensors [
        <xref ref-type="bibr" rid="ref3">3, 4, 5, 6, 7</xref>
        ]. GNNs typically model
ing a metric such as the vehicle count or average speed the road sensor network as a graph structure, whose
over the road network. This information can be used to weighted adjacency matrix reflects the strength of
intermake forecasts about the state of the road network in the sensor relationships.
near future, which can enable proactive responses when Despite an extensive body of work on trafic
forecastheavy or unusual load on the network is predicted. ing, there are still several major challenges in building a
      </p>
      <p>A wide range of forecasting approaches have been ap- practical trafic forecasting system. First, there are
chalplied to the trafic prediction task, from statistical meth- lenges around the scalable handling and pre-processing
of the streaming trafic data, as well as in its use for
realProceedings of the Workshop on Big Mobility Data Analytics (BMDA) time forecasting. Typically, most forecasting models are
co-located with EDBT/ICDT 2023 Joint Conference (March 28-31, 2023), developed ofline, without considering the challenges of
Ioannina, Greece producing forecasts on streaming data. The real-time
⋆ WThairswpiuckb,lipcraitoirotno dGeusncrdiubzesVewhobrikDpemerifrocri mjoeindinagt tImheagUinnaivtieornsiTtyecohf- forecasting problem requires that the forecasting process
nologies, Alexandros Sfyridis joining Imperial College London, and takes place continuously within a given time lag of each
Hakan Ferhatosmanoglu joining Amazon Web Services. real-world trafic event occurring. This is an important
† These authors contributed equally. problem to study for practical data-driven systems, as
‡Also with Amazon Web Services. transport managers need to be able to take action based
$ Chris.Conlan@warwick.ac.uk (C. Conlan); on responsive short-term forecasts. It has also been
idenJ.Oakley@warwick.ac.uk (J. Oakley); Gunduz.Demirci@imgtec.com tified as an open research issue, and entails significant
(HGa.kVa.nD.Fe@mwircair)w;Aic.kS.faycr.iudkis(@Hi.mFperehriaatlo.ascm.uakno(Agl.uS)fyridis); data management challenges, particularly when DL
mod© 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 els are employed [8]. Second, the focus of many previous
ICntEernUatRionWal(CoCrBkYs4h.0o).p Proceedings (CEUR-WS.org) works is the minimization of the average error across
models across both normal and peak trafic
conditions. We discover that LSTM is often a viable
alternative to a GNN based approach; although
LSTM produces poorer predictions on average,
it can achieve lower MAPE during crucial peak
time hours, which is typically more important in
practice. This indicates that LSTM yields fewer
large outlier errors, and as such may be better at
capturing unusual trafic patterns.</p>
      <sec id="sec-1-1">
        <title>The rest of the paper is organized as follows. Section</title>
        <p>2 presents related work. Section 3 formalizes the trafic
forecasting problem, and describes its real-time
extensions. Section 4 illustrates Dynamic Urban Events.
Section 5 describes the Flow-based GNN Adjacency Matrix.</p>
        <p>Section 6 introduces Foresight, our cloud-based real-time
forecasting system. Section 7 covers our experimental
analysis. Finally, Section 8 concludes the paper.
2. Related Work
all test samples. In practice, however, accurate forecasts
are most important when the network is under heavy
load, and/or when the trafic patterns on the network
are unusual compared with historical norms. Finally, in
addition to data captured at roadside sensors, dynamic
urban events (DUE) and vehicle-level flow data should
also be incorporated dynamically into forecasting models
to improve predictive performance.</p>
        <p>Towards addressing these challenges, we present
Foresight, a cloud-based spatio-temporal forecasting system
developed in collaboration with Transport for the West
Midlands (Tf WM). Foresight ingests real-time trafic data,
and constructs a Flow Aggregated Adjacency Matrix
(FAAM) based on the observed vehicle-level flow
between the network sensors, which supports graph-based
learning. To ensure timely inference results, it
leverages an automated ingestion, aggregation, and MLOps
pipeline. To focus on the times when forecasting is most
impactful, we develop a data-driven approach to
examine the performance of models at peak times. Finally, we
incorporate roadworks/road closures in Foresight. While
previous works incorporate roadwork information into
predictive models [9, 5], this is usually not done as part
of a real-time pipeline. The dynamic processing of these
DUEs into a format suitable for continuous inference
presents non-trivial challenges.</p>
        <p>
          The contributions of this work are as follows:
Numerous forecasting methods have been applied in the
trafic prediction domain. Forecasting is typically
undertaken with the use of statistical and machine learning
models. The Autoregressive Integrated Moving
Average (ARIMA) and its variations are the most widely used
time-series models [
          <xref ref-type="bibr" rid="ref1">1, 10, 11</xref>
          ]. In addition, many Machine
• We study the real-time forecasting problem, Learning (ML) models have been applied, with the
Supwhich seeks to perform inference (and the neces- port Vector Machine (SVM) [12, 13] and the Random
Forsary data aggregation and pre-processing) within est [12, 14, 15] being the most common. Deep Learning
a given time lag. (DL) solutions based on Artificial Neural Networks have
• We take a novel approach to the construction become increasingly popular due to their improved
foreof the adjacency matrix as a core component of casting accuracy and the ability to account for non-linear
graph-based ML models and leverage vehicle- dependencies [16]. Long Short-Term Memory (LSTM)
level flow data in order to model trafic prop- and Feed Forward Neural Networks (FFNN) are among
agation through the network. Translating this the models most frequently applied to forecast trafic
vehicle-level flow data into a FAAM presents lfows [
          <xref ref-type="bibr" rid="ref2">2, 17, 18</xref>
          ], with several hybrid approaches also
non-trivial data management challenges. GNN investigated [19, 20]. Finally, Graph Neural Networks
forecasting errors at peak times are reduced by (GNNs), which can capture the spatial dependencies
beup to 8.8% under this scheme. tween the trafic monitoring sensors by representing the
• We explore several approaches for transforming road network as a graph structure, have further improved
real-time DUE data (namely roadworks) into a prediction accuracy. Hence, multiple GNN applications
time series format, and incorporate them into a for trafic flow forecasting have been presented in recent
deep learning spatio-temporal forecasting model. years [
          <xref ref-type="bibr" rid="ref3">3, 4, 5, 6, 7, 21, 8</xref>
          ].
        </p>
        <p>Experiments demonstrate performance
improvements of up to 29.1%. 2.1. Dynamic Urban Events
• We present Foresight, a cloud-based system for
addressing the real-time trafic forecasting prob- Urban events such as roadworks have been shown to
siglem, which can continuously stream trafic data, nificantly impact trafic flow [ 22, 23]. Hence, the
incorleverage up-to-date roadwork information, and poration of auxiliary information about such events can
exploit trafic flow patterns to enhance forecast- further improve trafic forecasting performance. For
exing performance. ample, roadwork and accident information has been
uti• We perform experimental analysis of a variety of lized in trafic simulation systems, ML models and GNNs
time series forecasting methods in a new environ- [24, 9, 5]. A combination of roadworks and weather
conment. We compare the performance of multiple
ditions have also been added to a bi-directional LSTM
Autoencoder for short-term trafic prediction [25].
attracted relatively little attention in the large body of
research on the topic.</p>
        <sec id="sec-1-1-1">
          <title>2.2. GNN Adjacency Matrix</title>
        </sec>
        <sec id="sec-1-1-2">
          <title>3.1. Trafic Forecasting Problem</title>
          <p>In GNN models, the underlying graph structures are usu- We first present the definition of the trafic forecasting
ally represented with an adjacency matrix which repre- problem, where the goal is to predict the future state
sents the spatial relationships between the nodes of a of the road network, given a sequence of previously
obgraph [4]. Although GNN adjacency matrices are typi- served time series readings. Trafic information is
typically binary [26], multiple variations have been proposed cally obtained from roadside sensors, which can capture
[21]. For example, a real-valued distance-based adja- features such as trafic flow or average speed, to form a
cency matrix is a common alternative for representing (multivariate) time series. Given a set of sensors , we
the spatial dependencies between nodes, and has been ap- denote the trafic information observed across all
senplied in numerous trafic forecasting studies with GNNs sors as  ∈ R||×  , where  is the total number of
[27, 28, 29, 30, 31]. The travel time between nodes has predictive features used. Let () ∈ R||×  denote the
also been considered as an alternative to distance-based trafic signal observed at time , and  (′) ∈ R||× 
metrics [32]. More recently, the integration of dynamic denote the trafic signal to be predicted at time ′. Note
matrices has been introduced, that captures the dynamic that the number of target features  may be diferent to
changes in spatial dependencies of the graph and tends to  . We aim to learn a function  (· ) which maps from  ′
improve forecasting [33, 34]. Coarse origin-destination historical trafic signals to  future trafic signals:
(OD) data has been applied as a substitute for a
distancebased adjacency matrix [35]. However, to the best of our
knowledge, no previous work on GNN based forecasting [(−  ′+1), . . . , ()→]−− (· ) [ (+1), . . . ,  (+ )]
has leveraged granular vehicle-level flow data to model (1)
inter-sensor relationships.</p>
        </sec>
        <sec id="sec-1-1-3">
          <title>3.2. Real-Time Forecasting</title>
        </sec>
        <sec id="sec-1-1-4">
          <title>2.3. Forecasting Systems</title>
        </sec>
      </sec>
      <sec id="sec-1-2">
        <title>The real-time variant of the trafic forecasting problem</title>
        <p>In addition to statistical and ML/DL modelling ap- adds the constraint that all processing takes place within
proaches, forecasting systems have also been developed a specified duration following the end of each time bin.
as general tools for time series prediction and road man- In Foresight, anonymized streaming data is collected at
agement optimization. For example, the AutoAI for Time road cameras and ingested into the platform via an API
Series Forecasting (AUTOAI-TS) [36] automates fore- endpoint. Further details of this procedure are illustrated
casting techniques and addresses specific requirements in Section 6.1.
for time series data. DeepTRANS [37] combines the The real-time forecasting inference routine begins at
DeepTTE system [38] with DCRNN [7] for bus travel the end of each time bin, which are each  minutes long.
time estimation. The system uses archive information First, the raw vehicle-level data (held in cloud storage)
about bus and trafic flow from sensor data, and DCRNN is aggregated for the most recent time bin (i.e., the 
is used to estimate trafic speed at buses’ locations. The minutes from (− 1) to ()). We denote the time taken
TraficStream forecasting system leverages GNNs and for this aggregation as . Next, the aggregated data is
Continual Learning (CL) [39]. It constructs a sub-graph to pre-processed so that it is in the correct format for model
capture network expansion, and constraints are applied inference. This includes fetching and processing the
agon the current training model to integrate information gregated trafic count information for the last  ′ time
from historical data. bins, as well as retrieving any additional model-specific
data used for inference (e.g., roadwork time series,
adja3. Real-Time Spatio-Temporal cency matrix). The time taken for this phase is referred
to as   . Once the required data have been
proForecasting duced, the inference API endpoint is invoked to perform
the forecast. The time taken for inference processing to
In this section, we first describe the trafic forecasting occur, as in Equation 1, is denoted by  .
problem, before introducing its real-time variant. A key We require the following expression to be satisfied for
requirement of this procedure is that the aggregation, a system to be capable of real-time forecasting:
pre-processing and inference of the trafic data must take
place within a certain time lag of the real trafic events
occurring. These practical aspects of forecasting have (2)
  =  +    +  ≤</p>
        <p>︂[ ]︂
Combining  and ˆ, a new matrix ˜ = ˆ is</p>
        <p>constructed, which is the new feature vector passed to
the forecasting models. We evaluate these approaches
within the context of a GNN model in Section 7.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>5. Flow Aggregated Adjacency</title>
    </sec>
    <sec id="sec-3">
      <title>Matrix</title>
      <p>A value of   ≤  ensures that the shortest
forecasting horizon still pertains to information that is yet to
be aggregated in the system, and is therefore relevant to
network managers.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Dynamic Urban Events</title>
      <p>Foresight is able to leverage DUE data dynamically to
improve the accuracy of its forecasts. We use roadworks
data as an illustrative example, but other such informa- Graph Neural Networks (GNNs) are popularly used in
tion (e.g., social event data) could readily be applied in state-of-the-art forecasting models [27, 28, 29, 30, 31, 3,
a similar fashion. In the context of trafic forecasting, 34, 7]. These methods typically represent the trafic
senplanned and unplanned roadworks frequently influence sor network as a graph structure, whose adjacency matrix
the volume and nature of trafic propagation through the aims to capture spatial relationships between the sensors.
road network [22, 23], and so incorporating information The principle of GNN message passing and node
aggregaabout them into predictive models is important for ac- tion approaches in the context of trafic forecasting, such
curate predictions. Foresight automatically ingests DUE as difusion convolution [ 7], is to simulate trafic
propadata and processes it into a format which forecasting gation in the network. This method of extracting features
models can easily exploit. is typically embedded into a wider learning structure so</p>
      <p>
        Roadworks data is ingested into Foresight via the Street that temporal features can be learnt along with spatial
Manager API1, which is invoked daily to receive a feed features in an integrated fashion.
of planned roadwork events. We denote the set of all The graph structure which models the trafic sensor
roadworks listed by a given daily API call as . For network is described by an ||×| | (weighted) adjacency
each roadwork  ∈ , we obtain its latitude/longitude, matrix. The value at position (, ) approximates the
as well as its start and end dates  and . In order strength of the relationship between sensor  and sensor
to associate the live roadworks on a given day  with  . A popular method to assign weights in the adjacency
the road sensor network , we first select only those matrix is to calculate pairwise sensor distances measured
roadworks where  ≤  ≤ . Next, we calculate the in the road network [
        <xref ref-type="bibr" rid="ref3">31, 3, 7</xref>
        ].
road network distance (using an indicative driving speed The aim of this approach is to more realistically
reover a shortest path calculation on the road network) flect the actual flow of trafic in the network, compared
between each  ∈  and each  ∈ . These distances to blunt sensor separation measures such as Euclidean
populate an || * | | matrix  , with each entry (, ) distance. However, these measures alone are insuficient,
denoting the road network distance from live roadwork as sensor separation per-se does not necessarily indicate
 to trafic sensor  in the network. trafic flow levels. Even though two sensors are spatially
      </p>
      <p>To incorporate this roadwork-to-camera influence in- co-located, trafic might rarely pass between them
consecformation into the forecasting models, we convert  utively, or may flow in one direction significantly more
into a time series format at the same temporal granu- than the other; these properties cannot be easily captured
larity as the observed trafic data. This has been shown by this approach.
to be an efective method for adding roadwork data to We therefore develop a method for computing the
adforecasting models [5]. We define this as a new feature jacency matrix weights which uses vehicle-level flow
set with the same dimensions as , formally ˆ ∈ R||. data to more accurately determine the relationships
beEach entry ˆ ∈ ˆ() has a value between 0 and 1 which tween sensors. By leveraging the properties of granular
denotes the strength of the influence of the nearest active ANPR (Automatic Number Plate Recognition) data, our
roadwork to sensor  at time . method can anonymously capture (in order) the sequence</p>
      <p>
        We consider two approaches to approximate this influ- of sensors which the cars pass as they traverse the road
ence. The first is a binary thresholding approach, where network. By aggregating this information at the network
entries are activated if there is a roadwork within thresh- level, we are able to determine actual flows within the
old distance  metres of the sensor. The second method network. The new adjacency matrix is designed to
reinvolves first calculating the distance from each sensor tain the same dimensions used in most GNN methods for
to its nearest live roadwork, before normalizing these dis- spatio-temporal forecasting, so it can be directly
applicatances into [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ]. We perform this normalization using a ble within these methods.
thresholded Gaussian kernel, with threshold . The Flow Aggregated Adjacency Matrix (FAAM),
denoted as  ∈ R||×| |, is constructed by aggregating
observed flow between cameras within a given time frame.
      </p>
      <p>Input Data
Traffic Data
Event Data</p>
      <p>Ingestion &amp;
Aggregation</p>
      <p>Kinesis Data
Firehose
Athena
(SQL)
Lambda
CloudWatch</p>
      <p>Glue</p>
      <p>Scalable Cloud</p>
      <p>Storage</p>
      <p>S3</p>
      <p>ML Inference
SageMaker
Endpoint</p>
      <p>Lambda
Conditional</p>
      <p>Registration
ML Experiments</p>
      <p>MLOps Pipeline
Processing</p>
      <p>Training</p>
      <p>
        Evaluation
1 unit of flow is recorded between cameras  and  when
a car is observed at camera  ∈  at time , and is
then next observed  ∈  no later than  +  , where
 is a parameter given in seconds which denotes the
acceptable transition period. To construct  , each entry
, is incremented by 1 for each observed unit of flow.
, is then averaged over all the time periods during
which flow was observed, before being normalized into
[
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ]. Each entry , thus approximates the likelihood
of a vehicle transitioning directly from  to  within
transition period  . This can be periodically updated to
reflect changes in the network over time, such as
seasonality. We note that a more granular time scale would
be possible in this formulation, e.g., to capture shifting
trafic patterns throughout the day, but we leave this to
be explored in future work.
      </p>
    </sec>
    <sec id="sec-5">
      <title>6. System Architecture</title>
      <sec id="sec-5-1">
        <title>In this section we present an overview of the Foresight</title>
        <p>system, as illustrated in Figure 1. The overall goal of
Foresight is to provide continuous forecasts for transport
managers by leveraging streaming trafic data as well
as dynamic urban event and flow information. We will
ifrst describe how streaming trafic data is ingested and
aggregated, before presenting the MLOps pipeline and
forecasting inference procedure. Details of how DUE data
and flow information are processed are given in Sections
4 and 5 respectively.</p>
        <sec id="sec-5-1-1">
          <title>6.1. Streaming Data Ingestion,</title>
        </sec>
        <sec id="sec-5-1-2">
          <title>Aggregation and Storage</title>
        </sec>
      </sec>
      <sec id="sec-5-2">
        <title>Foresight’s primary data source is anonymized ANPR</title>
        <p>vehicle capture information in the West Midlands road
network managed by Tf WM. This data flows into
Foresight using a POST request to an API endpoint, before
being forwarded to a streaming ETL service (Kinesis Data
Firehose2). Individual vehicle captures (including a
timestamp, salted hash of vehicle registration, camera/lane of
observation and vehicle type) are bufered using this
service, and are periodically flushed to object storage
(once the bufer fills, or a short time period elapses).
The bufered file is also converted to a columnar format
(Apache Parquet3) for improved query performance.</p>
        <p>We next use a serverless data integration ofering (AWS
Glue4), to crawl the object storage buckets containing
these intermediate files periodically. This enables the
use of serverless SQL queries (via AWS Athena5) over
the columnar Parquet data. These queries generate
ag2https://aws.amazon.com/kinesis/data-firehose/
3https://parquet.apache.org
4https://aws.amazon.com/glue/
5https://aws.amazon.com/athena/
gregated trafic count data, illustrating the total number
of vehicles of each type (e.g., petrol car, HGV) that have
passed each roadside camera within the current time bin,
i.e., the last  minutes. We use scheduling
functionality in a cloud monitoring service (AWS CloudWatch6)
to trigger the SQL processing (via lightweight
serverless functions) for the current time bin. This procedure
writes a single file to object storage (AWS S3 7) per the
current time bin, which can later be used as an input to
ML workflows.</p>
        <sec id="sec-5-2-1">
          <title>6.2. MLOps Pipeline and Training</title>
          <p>are then written to object storage, where they can be
retrieved for downstream visualization.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>7. Experimental Analysis</title>
      <p>In this section we present the results of our experiments
to test the efectiveness of popular trafic forecasting
methods in a new setting. We then evaluate the impact of
incorporating DUE data as an additional dimension to the
input feature vector. We also consider the performance
impact of using the FAAM, in place of a distance-based
adjacency matrix, in a GNN forecasting model. Finally,
we explore the error profiles of our models, and their
eficiency within Foresight.</p>
      <p>We leverage an AWS SageMaker8 MLOps pipeline to
create and deploy forecasting models. Data scientists can
run experiments (e.g., in SageMaker Studio Notebooks)
over data held in object storage, using standard libraries 7.0.1. Road Camera Dataset
such as NumPy, PyTorch, TensorFlow, etc. Once a model The anonymized and aggregated data used for the
exhas successfully been designed, its source code can be periments is from a set of ANPR cameras in the West
pushed to one of two Git repositories (test, production) Midlands region of the UK, covering several large
conurhosted in AWS CodeCommit9. bations including Birmingham and Coventry. The precise</p>
      <p>Once a code update is performed in either reposi- locations of cameras remain private. The set of cameras
tory, the MLOps pipeline provisions a compute instance are spread over a variety of diferent road types, including
(whose size is specified by the data scientist) to perform many roads from inner city locations and smaller
conthe necessary pre-processing and training of the model. necting roads. This is diferent to many prior datasets,
The trained model is then deployed to a SageMaker end- such as METR-LA [40], where road sensors are typically
point (which resides on a provisioned compute instance), located on freeways where one can expect a high volume
where it can first be tested in a ‘staging’ environment of free-flowing trafic. The quality of this data is high; the
before being made available for live inference (if the pro- rate of missingness is only 2.3%, compared with 8.1% for
duction repository was updated). The MLOps pipeline METR-LA. We use linear interpolation to impute these
can be configured to re-train the model periodically, e.g., missing values.
once per week, to continually incorporate the latest
trafifc data.
7.0.2. Experimental Setup</p>
      <sec id="sec-6-1">
        <title>6.3. Real-Time Forecasting Inference</title>
        <p>As described in Section 6.1, the ANPR trafic data is
aggregated in periodic -minute time bins. We configure a
serverless function (AWS Lambda10) to be triggered each
time a new per-bin trafic file arrives in the specified S3
location. Once the serverless function is invoked, it first
retrieves the latest  ′ historical trafic files (see Section
3) and executes the required pre-processing logic. Note
that while this serverless function is lightweight, the
small data volume makes this processing eficient. Next,
any auxiliary data (e.g., adjacency matrices, roadworks
time series) required for inference is also fetched. The
resultant payload is sent to the live inference endpoint
described above, where trafic predictions for the next 
time bins over all sensors  are made. These predictions</p>
        <sec id="sec-6-1-1">
          <title>6https://aws.amazon.com/cloudwatch/</title>
          <p>7https://aws.amazon.com/s3/
8https://aws.amazon.com/sagemaker/
9https://aws.amazon.com/codecommit/
10https://aws.amazon.com/lambda/
The vehicle count data used in the experiments was
collected between August 5th and December 5th 2021
(inclusive), and was aggregated at 15 minute intervals. DUE
data was collected for the same period. The flow was
measured between August and November 2021 in order
to compute the FAAM. The data was split into training,
validation and test sets in a 70/10/20 ratio. We evaluate
performance using mean absolute error (MAE) and mean
absolute percentage error (MAPE). We also calculate the
error distribution’s coeficient of variation, which we
refer to as the error coeficient of variation (ECV). We refer
to the set of absolute errors across all test samples as ℰ ,
and hence  =  ((ℰℰ)) . The ECV allows us to compare
the dispersion of the error terms across diferent
distributions (i.e., the sets of errors made by diferent models),
as it normalizes by the mean error. A high ECV indicates
that predictions are inconsistent.</p>
          <p>We evaluate the results firstly over all time periods
in the test data, which we refer to as ‘Any Time’ (AT)
experiments. We also perform evaluation focusing only
on ‘Peak Times’ (PT). We identify peak times as those that
have historically shown high average trafic counts, but
also high levels of variability. High average trafic counts
indicate heavy load on the network, which we assume
are periods of interest for transport managers. High
levels of variability are a sign of challenging forecasting
conditions, and may denote periods of unusual trafic
conditions on the network. We identify these periods of
interest by first dividing the dataset into weekends and
weekdays, and then further splitting each of these into
hourly subsets. The mean and coeficient of variation
of each subset is then calculated. Any of these subsets
with both mean and coeficient of variation in the upper
two quartiles is classified as peak time. The only time
periods which satisfy this are 7am-8am, and 8am-9am on
weekdays, hence we select these as our peak times. This
selection also conforms closely to the domain knowledge
of our partners at Tf WM.</p>
        </sec>
      </sec>
      <sec id="sec-6-2">
        <title>7.1. Forecasting Models</title>
        <p>The following forecasting models have been evaluated
on the road camera dataset.</p>
        <p>• Historical Average (HA): We produce a
historical average matrix based on the training set. The
average reading over the training set is calculated
at each sensor in  for each of the 672 (4x24x7)
weekly time steps. To perform inference, we give
the historical average value of the target time
period as our prediction (the notion of  ′ historical
trafic signals is not applicable to this method).
• ARIMA: We iterate over all sensors and all test
examples. In each iteration, we train an ARIMA
model11, using the previous  ′ = 100 values as
11 = 1,  = 0,  = 1
the training input.
• Feed Forward Neural Network (FFNN): We
implement an FFNN, where the input consists of
the previous  ′ readings across all sensors  ∈ .
The model produces predictions for the next 
forecasting horizons. The network is constructed
with two hidden linear layers, with ReLU
activation functions. Model parameters are learned
using backpropagation, with an L1 loss function.
• Long Short Term Memory (LSTM): This is
implemented similarly to FFNN, except using LSTM
layers in place of linear layers. Within the LSTM
layers, input data is treated as a sequence and
temporal patterns are learnt using an additional
hidden layer to capture the cell state, which passes
information along the sequence.
• Difusion Convolutional Recurrent Neural
Network (DCRNN): We select DCRNN [7] as an
illustrative example of an efective GNN method.
This method has been previously identified as
one of the best-performing (GNN) approaches for
the trafic forecasting on benchmark datasets [ 8].
The model utilizes a distance-based adjacency
matrix to model the spatial relationships between
road sensors, and employs difusion convolution
and bidirectional random walks to simulate
trafifc propagation in the network. We utilize the
PyTorch implementation of DCRNN [7].
• DCRNN-RW-T / DCRNN-RW-G: DCRNN
with DUE adaption to include roadwork data.
DCRNN-RW-T associates live roadworks to
all sensors within a 1000m distance threshold.
DCRNN-RW-G uses thresholded Gaussian
kernel normalization (threshold  = 0.1).
• DCRNN-F: DCRNN with the FAAM representing</p>
      </sec>
      <sec id="sec-6-3">
        <title>7.2. Experimental Results</title>
        <sec id="sec-6-3-1">
          <title>All models are implemented in AWS SageMaker Studio</title>
          <p>using Python 3.6, on a ml.g4dn.xlarge instance. We use
PyTorch 1.8 to implement FFNN, LSTM, and DCRNN
(including all variants). Unless stated otherwise,  ′ =
 = 4, and  = 15 minutes. In practice, we make
predictions over horizons of 15, 30, 45 and 60 minutes
(henceforth referred to as 15m, 30m, 45m, 60m). The
more distant forecasting horizons (i.e., 45m, 60m) ofer
transport managers more time to implement pre-emptive
interventions on the road network. Hence, performance
gains here are particularly valuable.</p>
          <p>the underlying graph structure. An acceptable than LSTM across all forecasting horizons during the AT
transition period  between sensors is given as experiments (MAPE degradation - 15m: 22%, 30m: 25.8%,
3600 seconds and thresholded Gaussian kernel 45m: 21.3%, 60m: 11.3%); these discrepancies are
furnormalization ( = 0.1) is applied on the matrix. ther exacerbated in PT experiments (MAPE degradation
• DCRNN-RW-F: DCRNN with roadworks (using - 15m: 37.7%, 30m: 36.6%, 45m: 41.2%, 60m: 18.3%). This
Gaussian kernel method) and FAAM. is an interesting result as it suggests that while LSTM
makes poorer predictions on average (i.e., MAE), it also
makes fewer mistakes of a significant margin, leading
to a lower MAPE (this metric is highly sensitive to
outliers in the error term). It may therefore be inferred that
LSTM is better than DCRNN at predicting unusual trafic
patterns, especially at peak times. In terms of MAPE,
ARIMA was shown to be a highly competitive model
across all forecasting horizons, outperforming DCRNN
in all cases, with more pronounced gains in PT
experiments. As ARIMA is retrained on the most recent data
when evaluating each test sample (see Section 7.1), it
will naturally be more responsive to unusual trafic
patterns than models trained using a conventional train/test
split. LSTM still largely outperforms ARIMA in regards
to MAPE. HA performs particularly poorly on this
metric, due to its inability to dynamically respond to current
network conditions.</p>
          <p>We describe the key findings from our experimental
results, which are presented in Table 1. First, we
compare the performance of several existing forecasting
approaches in our new data setting. We then consider the
impact of incorporating roadworks as an exogenous input
feature, as well as using flow to determine edge weights
in the adjacency matrix. Next, we discuss our findings
pertaining to prediction reliability using ECV. Finally, we
analyze the eficiency of Foresight.
7.2.1. Analysis of Existing Approaches
We first consider the performance of several existing
spatio-temporal forecasting approaches in our new data
setting. During the AT experiments it can be observed
that DCRNN makes more accurate predictions across all
four time horizons (MAE improvements - 15m: 20.9%,
30m: 20.6%, 45m: 25.3%, 60m: 22.7%) compared to the
next closest model (LSTM), with the largest
improvements seen at the longest forecasting horizons. Similarly,
during the PT experiments DCRNN remains the most
accurate model. However, it is interesting to note that
the improvements compared to LSTM are now much
smaller (MAE improvements - 15m: 18.5%, 30m: 15.1%,
45m: 14.2%, 60m: 8.3%), and the trend at longer horizons
is reversed where we see the smallest MAE improvements.</p>
          <p>ARIMA tends to be a competitive model for shorter
horizons, during both PT and AT experiments, however the
performance deteriorates quickly at longer forecasting
horizons, which indicates that this model requires fresh
data to support accurate predictions. HA and FFNN make
the least accurate predictions across all forecasting
horizons.</p>
          <p>Diferent trends emerge when MAPE performance is
considered. DCRNN now exhibits poorer performance
7.2.2. DUE Analysis</p>
        </sec>
        <sec id="sec-6-3-2">
          <title>We also evaluate the impact of adding dynamic urban</title>
          <p>events to GNN models. Mixed results are achieved when
MAE is considered. DCRNN-RW-G, which associates
roadworks using a thresholded Gaussian kernel,
generally yields higher MAE than DCRNN across both AT and
PT experiments. These discrepancies in MAE are
particularly pronounced for long forecasting horizons during
peak times (MAE degradation - 45m: 5.4%, 60m: 11.4%).</p>
          <p>On the other hand, DCRNN-RW-T (binary thresholding)
achieves lower MAE compared to DCRNN over all AT
experiments. However, it still yields inferior performance
at more distant forecasting horizons at peak times (MAE
degradation - 45m: 1.4%, 60m: 2.1%).</p>
          <p>The results for MAPE present a contrasting picture,
where DCRNN-RW-G outperforms DCRNN-RW-T across
all experiments. During AT experiments (especially at
longer horizons), DCRNN-RW-G achieves significant
improvements compared to DCRNN (MAE improvements
- 45m: 29.8%, 60m: 29.1%). We observe a similar pattern
during peak times. These findings indicate that using a
thresholded Gaussian kernel during the construction of
a FAAM yields a reduction in large outlier errors (likely
resulting in improved performance under unusual road
network conditions).
7.2.3. FAAM Analysis
Our experimental results indicate that using vehicle-level
lfow data to model inter-sensor relationships is an
efective strategy. For AT experiments, DCRNN-F achieves utilize this system to develop methods for the
incorpolower MAE than DCRNN across all time horizons, and is ration of Dynamic Urban Event (DUE) and vehicle-level
particularly efective at long forecasting horizons (MAE lfow information into predictive models. We consider
improvement - 60m: 3.2%). Further, we observe even several approaches for associating roadworks to the
roadlarger MAE gains for DCRNN-F compared to DCRNN side sensors which they impact, and present a FAAM
at peak times (MAE improvement - 60m: 8.8%). These based on granular and anonymized vehicle-level flow
ifndings support the inclusion of vehicle-level flow data data. We implement and evaluate a range of time series
into GNN models for improved predictive performance. forecasting models in a new urban data setting, enabled</p>
          <p>We note that leveraging the FAAM in place of a by ANPR infrastructure in the West Midlands region. We
distance-based adjacency matrix (i.e., DCRNN) yields observe performance improvements of up to 29.1% for
MAPE improvements in all cases. However, the most GNN models when DUE and flow data are leveraged. Our
significant MAPE gains are still experienced by DCRNN- experimental results provide further insights on the
foreRW-G, indicating that incorporating roadworks is a more casting accuracy during peak times when accurate results
efective strategy for minimizing outlier errors. It should are more critical, compared to the traditional approach
be noted that DCRNN-F mitigates much of the degrada- of targeting the average accuracy. Further work may
tion in MAPE performance at peak times that DCRNN apply our approach for handling DUEs to more varied
sufers in comparison to LSTM, while also ofering lead- data sources beyond planned roadworks, such as weather
ing MAE results. or cultural event information. Our data-driven method
for identifying peak times could be compared to a
rele7.2.4. Error Coeficient of Variation vant ground truth. Foresight’s response time could be
improved, particularly via acceleration of . Finally,
As illustrated in Table 1, DL models, particularly those an additional temporal dimension could be added to our
which have been enhanced by DUE data or the FAAM, flow-based adjacency matrix.
experience the highest ECV (especially at longer
forecasting horizons). As shown above, it is at these more
distant horizons that the biggest performance improve- Acknowledgments
ments (MAE/MAPE) are observed for our augmented
models. This suggests that while these solutions produce
the best forecasts on average, their errors are the least
consistent. This finding is noteworthy, and we would
recommend further investigation to better understand
its implications.</p>
        </sec>
        <sec id="sec-6-3-3">
          <title>We thank Transport for the West Midlands and our collab</title>
          <p>orators there, particularly Tim Katheru, Andrew Burns
and Stuart Lester in the Data Insights team. This research
is also supported in part by the Feuer International
Scholarship in Artificial Intelligence, WM5G, and the UK
Engineering and Physical Sciences Research Council under
Grant No. EP/L016400/1.
7.2.5. Eficiency Analysis
As discussed in Section 3.2, the real-time forecasting task
requires that   =  +   + ≤ . In
the current version of Foresight, we allow for  ≤ 40
seconds. For all of the implemented forecasting
models,    ≤ 6 seconds. Each model except ARIMA
achieves  ≤ 2 seconds. As discussed above, at
inference time we train an ARIMA model over the
previous  ′ = 100 values for each  ∈ . For ARIMA,
 ≤ 16 seconds. Hence, all of the presented
models achieve   ≈ 1 minute, satisfying Equation 2
with significant headroom for  = 15 minutes. Further,
these results conform to alternative notions of real-time
forecasting [41], where predictions were produced in a
single-digit order of minutes.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>8. Conclusion</title>
      <sec id="sec-7-1">
        <title>In this work, we study the real-time spatio-temporal forecasting problem, and develop a cloud-based system in collaboration with Transport for the West Midlands. We</title>
        <p>[4] L. Franceschi, M. Niepert, M. Pontil, X. He, Learn- [13] Z. Zheng, L. Shi, L. Sun, J. Du, Short-term
trafing discrete structures for graph neural networks, ifc flow prediction based on sparse regression
36th International Conference on Machine Learn- and spatio-temporal data fusion, IEEE Access
ing, ICML 2019 2019-June (2019) 3481–3493. URL: 8 (2020) 142111–142119. doi:10.1109/ACCESS.
https://arxiv.org/abs/1903.11960v4. doi:10.48550/ 2020.3013010.</p>
        <p>arxiv.1903.11960. [14] O. Mohammed, J. Kianfar, A machine learning
ap[5] Y. Lu, P. Kamranfar, D. Lattanzi, A. Shehu, Traf- proach to short-term trafic flow prediction: A case
ifc flow forecasting with maintenance downtime study of interstate 64 in missouri, 2018 IEEE
Intervia multi-channel attention-based spatio-temporal national Smart Cities Conference, ISC2 2018 (2019).
graph convolutional networks (2021). URL: https:// doi:10.1109/ISC2.2018.8656924.
arxiv.org/abs/2110.01535v1. doi:10.48550/arxiv. [15] A. Barredo-Arrieta, I. Lana, J. D. Ser, What lies
be2110.01535. neath: A note on the explainability of black-box
[6] L. Zhao, Y. Song, C. Zhang, Y. Liu, P. Wang, machine learning models for road trafic
forecastT. Lin, M. Deng, H. Li, T-gcn: A temporal ing, 2019 IEEE Intelligent Transportation Systems
graph convolutionalnetwork for trafic pre- Conference, ITSC 2019 (2019) 2232–2237. doi:10.
diction, IEEE Transactions on Intelligent 1109/ITSC.2019.8916985.</p>
        <p>Transportation Systems 21 (2018) 3848–3858. [16] LiYaguang, ShahabiCyrus, A brief overview of
URL: http://arxiv.org/abs/1811.05320http: machine learning methods for short-term trafic
//dx.doi.org/10.1109/TITS.2019.2935152. forecasting and future directions, SIGSPATIAL
doi:10.1109/TITS.2019.2935152. Special 10 (2018) 3–9. URL: https://dl.acm.org/doi/
[7] Y. Li, R. Yu, C. Shahabi, Y. Liu, Difusion con- 10.1145/3231541.3231544. doi:10.1145/3231541.
volutional recurrent neural network: Data-driven 3231544.
trafic forecasting, International Conference on [17] X. Luo, D. Wang, D. Ma, S. Jin, Grouped travel
Learning Representations, ICLR, 2017. URL: https:// time estimation in signalized arterials using
pointarxiv.org/abs/1707.01926v3. doi:10.48550/arxiv. to-point detectors, Transportation Research Part B:
1707.01926. Methodological 130 (2019) 130–151. doi:10.1016/
[8] K. H. N. Bui, J. Cho, H. Yi, Spatial-temporal graph J.TRB.2019.10.007.</p>
        <p>neural network for trafic forecasting: An overview [18] D. Ma, X. Song, P. Li, Daily trafic flow
foreand open research issues, Applied Intelligence 52 casting through a contextual convolutional
recur(2021) 2763–2774. URL: https://link.springer.com/ rent neural network modeling inter- and
intraarticle/10.1007/s10489-021-02587-w. doi:10.1007/ day trafic patterns, IEEE Transactions on
IntelS10489-021-02587-W/TABLES/5. ligent Transportation Systems 22 (2021) 2627–2636.
[9] W. Alajali, W. Zhou, S. Wen, Y. Wang, Intersection doi:10.1109/TITS.2020.2973279.
trafic prediction using decision tree models, [19] Y. Tian, K. Zhang, J. Li, X. Lin, B. Yang,
LstmSymmetry 2018, Vol. 10, Page 386 10 (2018) 386. based trafic flow prediction with missing data,
NeuURL: https://www.mdpi.com/2073-8994/10/9/386/ rocomputing 318 (2018) 297–305. doi:10.1016/J.
htmhttps://www.mdpi.com/2073-8994/10/9/386. NEUCOM.2018.08.067.</p>
        <p>doi:10.3390/SYM10090386. [20] Q. Zhaowei, L. Haitao, L. Zhihui, Z. Tao,
Short[10] P. Duan, G. Mao, W. Yue, S. Wang, A unified starima term trafic flow forecasting method with m-b-lstm
based model for short-term trafic flow prediction, hybrid network, IEEE Transactions on Intelligent
IEEE Conference on Intelligent Transportation Sys- Transportation Systems 23 (2020) 225–235. doi:10.
tems, Proceedings, ITSC 2018-November (2018) 1109/TITS.2020.3009725.</p>
        <p>1652–1657. doi:10.1109/ITSC.2018.8569964. [21] W. Jiang, J. Luo, Graph neural network
[11] T. Alghamdi, K. Elgazzar, M. Bayoumi, T. Sharaf, for trafic forecasting: A survey,
ExS. Shah, Forecasting trafic congestion using pert Systems with Applications 207 (2021).
arima modeling, 2019 15th International Wire- URL: http://arxiv.org/abs/2101.11174http:
less Communications and Mobile Computing Con- //dx.doi.org/10.1016/j.eswa.2022.117921.
ference, IWCMC 2019 (2019) 1227–1232. doi:10. doi:10.1016/j.eswa.2022.117921.
1109/IWCMC.2019.8766698. [22] M. M. Bruwer, S. J. Andersen, W. Merrick,
Measur[12] D. Xu, Y. Shi, A combined model of random forest ing the impact of roadworks on trafic progression
and multilayer perceptron to forecast expressway using floating car data, 2021.
trafic flow, Proceedings of 2017 IEEE 7th Interna- [23] C. Schwietering, M. Feldges, Improving trafic
tional Conference on Electronics Information and lfow at long-term roadworks, Transportation
ReEmergency Communication, ICEIEC 2017 (2017) search Procedia 15 (2016) 267–282. doi:10.1016/
448–451. doi:10.1109/ICEIEC.2017.8076602. J.TRPRO.2016.06.023.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>K. L.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. J.</given-names>
            <surname>Zhai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <article-title>Short-term trafic flow prediction using a methodology based on arima and rbf-ann</article-title>
          , Proceedings - 2017
          <string-name>
            <surname>Chinese Automation</surname>
            <given-names>Congress</given-names>
          </string-name>
          ,
          <string-name>
            <surname>CAC</surname>
          </string-name>
          <year>2017</year>
          2017-
          <fpage>January</fpage>
          (
          <year>2017</year>
          )
          <fpage>2804</fpage>
          -
          <lpage>2807</lpage>
          . doi:
          <volume>10</volume>
          .1109/CAC.
          <year>2017</year>
          .
          <volume>8243253</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Fu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Using lstm and gru neural network methods for trafic flow prediction</article-title>
          ,
          <source>Proceedings - 2016 31st Youth Academic Annual Conference of Chinese Association of Automation, YAC</source>
          <year>2016</year>
          (
          <year>2017</year>
          )
          <fpage>324</fpage>
          -
          <lpage>328</lpage>
          . doi:
          <volume>10</volume>
          .1109/YAC.
          <year>2016</year>
          .
          <volume>7804912</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Pan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Long</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Jiang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Zhang, Connecting the dots: Multivariate time series forecasting with graph neural networks</article-title>
          ,
          <source>Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining</source>
          <volume>20</volume>
          (
          <year>2020</year>
          )
          <fpage>753</fpage>
          -
          <lpage>763</lpage>
          . URL: https://arxiv.org/abs/
          <year>2005</year>
          .11650v1. doi:
          <volume>10</volume>
          .48550/arxiv.
          <year>2005</year>
          .
          <volume>11650</volume>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>