Fairness pipeline for Prediction Fairness (PF) and Resource Allocation Fairness (RAF): it starts by defining evaluation groups and comparing predicted and actual crime probabilities. The spatial regions in each city were categorized into two groups: group 1 G1, composed by areas with a low perception of poverty and a high income, and group 2 G2, including areas with a high perception of poverty and a low income, i.e., potentially vulnerable or socially disadvantaged areas. PF metrics are computed using error functions, such as f(M, G1*) = |0.5 - 0.0| = 0.5, and disparities are measured using Max-min and Gini. RAF fairness is then assessed through precision metrics derived from confusion matrices, e.g., precision(M, G1*) = 0, precision(M, G2*) = 1.
This repository contains the code used to develop the research presented in the paper "Quantifying Fairness in Spatial Predictive Policing". The project implements and evaluates spatial predictive models (SEPP, KDE, Naive KDE) on crime data from Bogotá and Chicago, focusing on quantifying and analyzing the fairness of predictions in different regions.
Crime Heatmap Bogotá
Crime Heatmap Chicago
The predictive algorithms implemented are SEPP, KDE, and Naive KDE. These models were implemented using base code developed by the QuantCrime Lab at the University of Leeds, available at: QuantCrime Lab - PredictCode.
The project is organized into key folders for experimental scripts, custom libraries (including base code from University of Leeds), examples, and data (raw, processed, results for Bogotá and Chicago). A global configuration file manages variables across scripts.
.
├── Experiment_Scripts/
├── Librerias/
├── Examples/
├── Data/
├── global_vars.py
└── README.md
For a detailed breakdown of each folder and its contents, please refer to the project structure section in the README.md.
To set up the project locally, ensure you have Python 3.7+, pip, and git. Then, clone the repository, create a virtual environment, and install dependencies from `requirements.txt`.
For detailed step-by-step instructions, please see the installation guide in the README.md.
The results, including metrics, visualizations, and predictions, are stored in the Data/ folder, organized by city. These allow for examination of model performance, prediction distribution, and fairness metrics comparisons.
Max-min and Gini metrics for fairness evaluation in Bogotá and Chicago. Each point along the X-axis represents the percentage of area analyzed in each group relative to the total predictions. Along the Y-axis, the Max-min metric represents the disparity in benefits, while the Gini metric represents the percentage of this benefit disparity. These metrics are depicted for each model under evaluation.
Trend of classification precision for patrolled and non-patrolled areas across a specific percentage range of the total coverage area (1% to 30%, simulating real scenarios) in each model for G1 and G2 from predictions in Chicago and Bogotá.
This article is currently undergoing major peer review. Contact details and citation instructions will be provided upon completion of the review process.