Data ScienceMachine Learning

NYCER: A Non-Emergency Response Predictor for NYC using Sparse Gaussian Conditional Random Fields (GCRFs)

Introduction

Cities have limited resources that must be used efficiently to maintain their smooth operation. To ensure smooth operation of cities, single non-emergency helpline numbers have been established in the last  two decades  and have been widely adopted by major cities  in multiple countries around the world. In both USA and Canada, this special non-emergency telephone number is 311. New York City (NYC)  implements one of the largest 311 operations in  USA. It began its operation in 2003. To enable the government to run these services efficiently, all data related to 311 service requests from 2010 have been made publicly available and is updated daily.

To facilitate efficient resource allocation and management in cities, in this article, we study one such important problem: how long does it take to resolve non-emergency 311 service requests? We present NYCER, a Non-emergency Response prediction system based on a recently developed structured regression model, sparse Gaussian conditional random fields (GCRFs), that successfully captures the dependencies between historical and future response times. Through extensive experimentation on 311 service requests in New York City (NYC) over a three and a half year period between Jan 2015 to June 2018, we demonstrate that our trained system is able to accurately predict future response times one week in advance using just the previous two weeks data at test time. NYCER achieves superior prediction performance across all agencies, complaint types, and locations, when compared to a linear regression baseline (up to a factor of 2X). The trained NYCER system requires low computational resources and data at test time, thus making it an attractive system that can be readily deployed in practice.

Data

We use the data collected and distributed by NYC open data, a site that provides 311 complaints since 2010, updated daily. This data contains 17, 945, 594 rows, and 41 different attributes providing extensive information associated with each complaint. For the purposes of our study, we select the following attributes to work with:

  1. Created Date – Specifies the date and time the complaint was created.
  2. Closed Date – Specifies the date and time the complaint was closed.
  3. Agency – Specifies the responding city government agency.
  4. Complaint Type – Identifies the topic of the complaint.
  5. Location – Specifies the borough of the complaint.

Response times are calculated by subtracting Created Date from Closed Date. Figure 1 shows the median response time per day, across all years of data.

Figure 1: Median response time per day

Figures 2a, 2b and 2c presents the average median response times for each agency, complaint type, and location, respectively. These agencies, complaint types, and locations are sorted on the total number of complaints received by them. These figures illustrate that the median response time per day varies significantly across different agencies, complaint types, and locations.

Figure 2a) Agency
Figure 2b) Compliant Type
Figure 2c) Location

Problem Statement

Implementing an effective non-emergency response system in a large city such as New York City (NYC) is a challenging endeavor, due to the sheer volume of complaints and uncertainty associated with how, when, and where people can lodge a complaint. Allocating sufficient resources ahead of time is crucial in improving response times of different types of complaints. A system that predicts future response times can thus be beneficial in understanding where resources can be better allocated. Recognizing the short-term trends in median response time, along with variation in average median response time based on factors such as agency, complaint type, and location, we observe that response time has an underlying structure that can be captured in a predictive model. In this work, we develop a predictive modeling system using a recently developed structured regression graphical model, sparse GCRFs to predict future median response time based on past median response time. 

NYCER System

In this section, we provide an overview of our non-emergency response prediction system, NYCER. Figure 3 shows the different components of our system. NYCER takes 311 service request data as input and produces predicted response times for the future as output. NYCER comprises of two main components: i) the data pre-processing component, which pre-processes the 311 service request data with respect to a number of factors such as agency and complaint type to produce processed data, and ii) the prediction component consisting of the GCRF models that takes the pre-processed data to generate the desired predictions. 

Figure 3: NYCER Architecture

Figures 4 and 5 illustrate the data pre-processing and the model components in more detail, respectively. NYCER leverages and adapts sparse Gaussian Conditional Random Fields (GCRFs) to predict future response times based on historical data. Since capturing the precise dependence among input features is a difficult and time-consuming task, in our problem, instead of modeling the joint distribution of both observed features (historical response times) and target variables (future response times), we only model the posterior distribution of the future response times given the historical response times. 

Figure 4: NYCER Architecture of Data Pre-Processing Component. Raw data is filtered, and cloned to 3 different datasets, one each for agency, complaint type, and location.
Figure 5: NYCER Architecture of GCRF Models Unit. For each time series within each dataset, we produce training and testing samples, which a GCRF model will use to learn its parameters, and generate predictions respectively.

GCRFs are a great choice for this problem as they accomplish what we need with minimal assumptions. Our GCRF Response model uses past response times to predict future response, is computationally efficient and considers only minimal past information (past 2 weeks) at test time. Furthermore, the sparse nature of our model aids in learning only those dependencies among the observed features and target variables that are helpful in the prediction, thus ensuring that the model has the ideal and required amount of complexity.

 

Training and Test

The primary objective of NYCER is to accurately predict future response times for 7 days based on previous 14 days data. To enable NYCER to provide accurate fine-grained predictions with respect to agency, complaint type, and location, we train separate GCRF models on data filtered according to these different attributes. At training time, our GCRF models use the first 75% of the sequences generated from the sliding window, which have 𝑡 weeks input and 1 week output. At test time, our GCRF models use the remaining 25% of sequences from the sliding window.

Performance Results

In this section, we present experimental results that demonstrate the superior predictive performance of NYCER. We compare the performance of NYCER with a linear regression baseline that fits the best straight line to the data. Figures 6a, 6b, and 6c show the RMSE values for each of the seven days for each agency (e.g., NYPD), complaint type (e.g., Heat), and location (e.g., Manhattan), respectively.

Figure 6 a) Agency: NYPD
Figure 6b) Compliant Type: Heat
Figure 6c) Location: Brookyln

We observe from these figures that the GCRF Response model outperforms linear regression across agencies, complaint types, and locations in per day prediction as well, particularly achieving a significantly better performance further in the prediction sequence. The main reason behind this behavior is that the GCRF Response model learns the trend from historical responses, and is capable of predicting the weekly peaks and dips in response time, whereas linear regression can only produce a best fit straight line. The GCRF Response model learns these trends by finding the strength of dependencies between historical and estimated response times, along with dependencies amongst the predictions, that maximize the likelihood of the data.