Downloads · 30 days
0
ADAMlam-16/chicago-crime-arrest-predictor
chicago-crime-arrest-predictor is a machine learning model from ADAMlam-16. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Can we predict whether a crime in Chicago will result in an arrest — based purely on environment, time, and location?
Downloads · 30 days
0
Access
Public
Updated Jun 12, 2026
Repo size
86.8 MB
Likes
0
Public
Click a slice to open those files.
.mp486.2 MB · 99%
From the Hugging Face model README
Can we predict whether a crime in Chicago will result in an arrest — based purely on environment, time, and location?
| File | Description |
|---|---|
notebook.ipynb | Full Colab notebook with all code, analysis, and results |
chicago_crime_gb_model.pkl | Winning Regression model (Gradient Boosting Regressor) |
chicago_crime_gb_classifier.pkl | Winning Classification model (Gradient Boosting Classifier) |
presentation.mp4 | Full walkthrough video presentation |
README.md | This file |
Source: gymprathap/Chicago-Crime-Dataset on Hugging Face
The raw dataset contains ~8 million rows of real Chicago Police Department crime reports with 21 features covering crime type, location, date/time, district, arrest status, and more.
After preprocessing:
ID, Case Number, IUCR, Beat, Ward, FBI Code, Block, X/Y Coordinates)Hour, Month, Year) from the Date columnWhat are the factors that most influence whether a person who has committed a crime is arrested?
This project approaches that question from two angles:

The pipeline runs from raw dataset → EDA → baseline model → feature engineering (including clustering) → three improved regression models → convert to classification → three classification models → export winning models to HuggingFace.
EDA was used to tell the story of the data and identify the strongest predictors of arrest before any model was built. Four key questions were explored:
A quadrant analysis (crime volume × arrest rate per district) revealed extreme policing differences across Chicago.
The data suggests a more nuanced conclusion: geographic policing outcomes are driven by structural and resource factors, not just crime volume alone.
High arrest rates correlate strongly with police-initiated incidents (narcotics, interference with officers) — crimes where the arrest is the intended outcome of the police interaction. Reactive crimes committed against people or property (burglary, theft) show low arrest rates because police arrive after the fact.
This distinction between proactive and reactive policing became a core conceptual framework for the entire project.
Location type is a strong predictor. In private spaces (homes, near ATMs) police typically arrive long after the crime and rarely catch anyone. In monitored or controlled spaces (airports, stairways, elevators) arrest rates are far higher due to constant police presence or camera coverage.
Your surroundings at the moment of a crime are a significant factor in whether an arrest follows.
| Factor | Impact on Arrest Rate |
|---|---|
| Crime Type (proactive vs. reactive) | ⬆️ Very High |
| Micro-location (monitored vs. private) | ⬆️ High |
| Hour of day | ⬆️ Moderate–High |
| Police District | ⬆️ Moderate |
| Month of year | ➡️ Low |
Features were selected and built based on the EDA findings:
Date: Hour, Month, YearLocation Description and District| Archetype | Description |
|---|---|
| High-Volume / High-Arrest | e.g. District 11 |
| High-Volume / Low-Arrest | e.g. Districts 10, 15 |
| Lower-Volume / Mixed | Remaining districts |
Target: Hourly arrest rate (continuous, 0.0–1.0) for each (Time, District, Location) group.
| Metric | Score |
|---|---|
| MAE | 0.2264 |
| RMSE | 0.2796 |
On average the baseline prediction was off by ~22.6 percentage points. It captured mild central cases reasonably but failed at the extremes.
| Model | Performance vs. Baseline |
|---|---|
| Linear Regression (engineered) | Improved |
| Random Forest Regressor | Lower MAE / Higher R² |
| Gradient Boosting Regressor ✅ | Best overall |
Winner: Gradient Boosting Regressor — exported as chicago_crime_gb_model.pkl
The improvement from baseline to engineered features was meaningful but not dramatic — which is expected. Predicting whether a person will be arrested involves social and psychological dynamics that no finite feature set can fully encode.
The continuous arrest rate target was converted into a binary classification problem.
A median split was attempted first, but since most crimes have zero arrests, the median was exactly 0.0. The most meaningful and natural threshold became Zero vs. Non-Zero:
| Class | Meaning |
|---|---|
| Class 0 | Arrest rate = 0.0 — zero arrests made ("total getaway") |
| Class 1 | Arrest rate > 0.0 — at least one arrest made |
| Class | Approximate Share |
|---|---|
| Class 0 (No Arrest) | ~85% |
| Class 1 (Arrest) | ~15% |
The dataset is heavily imbalanced. A model that always guesses "no arrest" would score ~85% accuracy while being completely useless. For this reason, Precision and F1-Score for Class 1 are the primary evaluation metrics.
From the perspective of a real-world policing tool, False Positives are more damaging than False Negatives. Sending patrol resources to a location that yields no arrest wastes time and erodes trust. Therefore Precision (of predicted arrests, how many were real) is prioritized over Recall (how many real arrests were found).
Three classifiers were trained on the engineered features, all using class_weight='balanced' to account for the imbalance.

Logistic Regression's primary failure mode is massive False Positives (13,832). Because it is a linear algorithm it compensates by aggressively predicting "Arrest," catching many true positives but triggering far too many false alarms. Not suitable for resource allocation.

Random Forest is more balanced than Logistic Regression — fewer False Positives (12,439) with a similar True Positive count (17,370). A stronger model but still generates a significant volume of false alarms.

Gradient Boosting is the most conservative and precise model. It achieves the fewest False Positives (5,720) by being selective — only predicting "Arrest" when the environmental signal is strong. This comes at the cost of more False Negatives (16,715), but for operational use that trade-off is correct: it is far better to miss some arrests than to waste resources on false alarms.
| Model | Precision (Class 1) | Recall (Class 1) | F1 (Class 1) | False Positives |
|---|---|---|---|---|
| Logistic Regression | lower | high | ~0.60 | 13,832 ❌ |
| Random Forest | medium | medium | ~0.60 | 12,439 ⚠️ |
| Gradient Boosting ✅ | 0.67 (highest) | lower | ~0.51 | 5,720 ✅ |
Winner: Gradient Boosting Classifier — exported as chicago_crime_gb_classifier.pkl
import pickle
# Load the regression model
with open('chicago_crime_gb_model.pkl', 'rb') as f:
reg_model = pickle.load(f)
# Load the classification model
with open('chicago_crime_gb_classifier.pkl', 'rb') as f:
clf_model = pickle.load(f)
# Both models expect the engineered feature set from Part 4 of the notebook.
# See notebook.ipynb for the full feature engineering pipeline.
# Predict arrest rate (regression)
# y_pred_rate = reg_model.predict(X_new) # float 0.0–1.0
# Predict arrest / no arrest (classification)
# y_pred_class = clf_model.predict(X_new) # 0 = no arrest, 1 = arrest
Python 3.10+
pandas, numpy
scikit-learn
plotly, matplotlib, seaborn
folium
datasets (HuggingFace)
scipy, statsmodels
All random operations use SEED = 42 for full reproducibility.
adam lambez