Crime Arrest Prediction Engine — Our Second Semester Final Project
For our second semester final project, we built a Crime Arrest Prediction Engine using Chicago crime data, Random Forest, MySQL, and FastAPI — supervised by Dr. Bilal Ahmad.
There is a meaningful difference between a project that demonstrates you have learned something and a project that actually does something. The first kind proves competence. The second kind builds it in a way that no assignment can replicate, because the problems you encounter are not problems someone designed for you to solve — they are problems the work itself generates, unpredictably, at inconvenient moments, with no answer key available. Our second semester final project at UET Faisalabad was the second kind. We built a Crime Arrest Prediction Engine, trained on the Chicago crime dataset spanning 2001 to 2004 — nearly 1.9 million records of real criminal incidents — and the experience of building it was unlike anything the first semester had produced.
The project was supervised by Dr. Bilal Ahmad, and the choice of problem reflected something he has consistently emphasized: that machine learning is most valuable when it is applied to problems that have genuine consequences in the real world. A model trained on synthetic or trivial data teaches you the mechanics of machine learning. A model trained on 1.9 million crime records, designed to predict whether a reported incident would result in an arrest, forces you to confront questions that go beyond the mechanics — questions about what the data actually represents, what the predictions actually mean, and what the limitations of a statistical model are when the subject matter is human behavior and the justice system.
The dataset came from the City of Chicago’s public records — detailed logs of criminal incidents including the type of crime, its location coordinates, the district and beat where it occurred, the date and time, whether a domestic incident was involved, and critically, whether an arrest was made. Working with nearly two million rows of data was itself a new kind of challenge. The computational demands were different. The cleaning requirements were more extensive. The decisions about how to handle missing values, how to encode categorical features, and which columns to include in the model had consequences that were visible at scale in ways they had not been on the smaller datasets we had worked with before.
My project partner was Eman Fatima, and the collaboration shaped the project in ways that solo work cannot. Dividing the work required us to define clear interfaces between different parts of the system — she could not complete her component without knowing exactly what format my component would produce, and vice versa. That coordination overhead is not a cost in any negative sense; it is the actual nature of engineering work done in teams, and learning to work within it — to communicate precisely about technical decisions, to agree on specifications before building, and to integrate components that were developed independently — was one of the most practically important lessons the project delivered.
The technical stack we used reflected the full scope of what second semester had covered. The machine learning model was built in Python using Scikit-learn, with a Random Forest classifier as the core algorithm. Random Forest was the right choice for this problem for the same reasons it is generally well-suited to tabular classification tasks: it handles mixed feature types gracefully, it is robust to outliers, it produces feature importance scores that help interpret what the model is actually using to make predictions, and it does not require the kind of careful hyperparameter tuning that more sensitive algorithms demand. We also connected the model to a MySQL database — bringing together the two courses Dr. Bilal Ahmad had taught us — storing the crime records in a properly designed relational schema and querying them as part of the prediction pipeline.
The model’s results told an interesting story. We achieved 82.4% accuracy on the test set, with a ROC-AUC score of 89.4%. Those numbers sound strong, and in some respects they are — an AUC of 89.4% means the model is substantially better than random at distinguishing cases that ended in arrest from those that did not. But the precision of 34.9% told a more complicated story. Of all the cases the model predicted would result in an arrest, only about a third actually did. The recall of 64.7% meant we were catching a reasonable proportion of the actual arrests, but at the cost of many false positives. Understanding this tradeoff — why optimizing for one metric comes at the expense of another, and what that means for how the predictions should be used — was exactly the kind of nuanced technical thinking that the project demanded and that a simpler dataset would not have surfaced as clearly.
The frontend of the system was built using HTML, CSS, and JavaScript, with FastAPI serving as the backend that connected the user interface to the machine learning model and the database. A user could enter the details of a crime incident — type, location, time, district — and the system would return a prediction of whether an arrest was likely, along with a probability score. Building this end-to-end pipeline — from raw data in a MySQL database through a trained Random Forest model to a prediction served via API and displayed in a browser — required integrating every major technical area the second semester had covered. It was the most complete piece of engineering work I had done up to that point.
The database design for the project was its own substantial undertaking. The Chicago crime data has a relational structure: crimes occur at locations, are classified according to a lookup table of crime types, are associated with districts and beats, and reference FBI codes for standardized categorization. Designing a schema that captured all of these relationships correctly — with appropriate foreign keys, indexes for query performance, and normalized tables that avoided redundancy — required applying everything Database Systems had taught about entity-relationship modeling and the principles of good relational design. Dr. Bilal Ahmad reviewed our ER diagram as part of the project, and his feedback sharpened both the design and our understanding of why the design choices mattered.
The exhibition where we presented the finished system brought back the experience of first semester’s ML project exhibition, but at a higher level of sophistication. The questions from faculty were more technical, the expectations for our understanding of the system’s limitations were higher, and the standard for what counted as a satisfactory explanation had risen accordingly. Presenting a system that predicts arrest likelihood from crime data invites questions that go beyond the technical — about what such a system could and could not responsibly be used for, about the assumptions embedded in historical crime data, about the difference between a pattern in data and a causal claim about the world. Engaging with those questions seriously, in front of an audience, was the most intellectually demanding part of the exhibition.
Second semester ended with this project completed, evaluated, and submitted. The distance between where I had started — with Python syntax I was still learning to read fluently — and where I had arrived — with a deployed machine learning system connected to a relational database and served through a web API — was not something I could have fully anticipated at the beginning. That distance is what two semesters of focused, demanding work produces. And the project that measured it most precisely was this one.
This project was built under the supervision of Dr. Bilal Ahmad, whose research in machine learning and AI systems has directly shaped the kind of work his students pursue. Connect with him on LinkedIn to follow his ongoing work.
