← All projects

ML & Deep Learning

Chicago Crime Classifier

An ANN that classifies ~400,000 Chicago crime records as violent or non-violent, ingested live from the City of Chicago Socrata Open Data API.

77.4%honest test accuracy after catching a 99.8% data-leakage result

Stack: Python, TensorFlow/Keras, scikit-learn, pandas

Live demo

A working version of this project will run right here.

Coming soon

Plan: Interactive results explorer built from pre-computed outputs: crime by hour, district and season, plus the leakage before/after story. Retraining on 400K live records is not practical in a browser.

TODO: build and embed the demo

Key findings

  • The first model scored ~99.8%: the description column encoded the crime type. I detected it, removed the feature and rebuilt the pipeline.
  • The genuine result is ~77.4% test accuracy (test loss ~0.495).
  • Crime peaks between midnight and 2 AM and is lowest between 4 and 6 AM.
  • Volume differs about 4x across districts, with a summer (May to August) surge.
  • Geographic clustering points to uses in patrol scheduling, budget allocation and seasonal planning.

How it works

  • Live ingestion from the City of Chicago Socrata Open Data API, with no manual downloads.
  • 206 input features, then Dense 128 (ReLU), Dropout 30%, Dense 64 (ReLU), Dropout 30%, Sigmoid output.
  • Adam optimizer, binary cross-entropy, batch size 256, EarlyStopping with patience 3.

Code and write-ups