Skip to content

Repository files navigation

Crime Classification Project

Project Banner

Project Overview

The Crime Classification Project implements a machine learning system to classify crimes into six categories:
Murder, Rape, Assault, Body Found, Kidnap, Robbery.

The project aims to:

  • Analyze crime data efficiently.
  • Build predictive models to classify crimes accurately.
  • Provide interactive visualization for insights using Streamlit.
  • Deploy a user-friendly Flask web app for real-time predictions.

This project uses XGBoost and AdaBoost classifiers to achieve high accuracy and interpretability.


Key Features

  • Data cleaning and preprocessing (cleaning.py)
  • Model training, selection, and evaluation (training.py)
  • Feature importance analysis
  • Learning curve visualization
  • Streamlit dashboard (crime_dashboard.py)
  • Flask web app (app.py + index.html) for live predictions
  • Model persistence (model.pkl, encoder.pkl)

Folder Structure

crime-classification/
│
├── cleaning.py
├── training.py
├── app.py
├── index.html
├── crime_dashboard.py
├── model.pkl
├── encoder.pkl
├── df.pkl
├── requirements.txt
├── README.md
└── assets/
    ├── dashboard.png
    ├── flask_app.png
    ├── confusion_matrix.png
    ├── feature_importance.png
    └── banner_screenshot.png

Installation

1. Clone the repository:

git clone https://github.com/yourusername/crime-classification.git
cd crime-classification

2. Make the virtual environment

python -m venv venv
source venv/bin/activate      # Linux/Mac
venv\Scripts\activate         # Windows

Install the requirements.

pip install -r requirements.txt

Data Description

The dataset contains numeric and categorical features relevant to crime analysis. The target column is crime with six classes:

Crime Type Label
Murder 0
Rape 1
Assault 2
Body Found 3
Kidnap 4
Robbery 5

Note: The project currently uses a sample dataset for demonstration, but all scripts are compatible with real crime datasets.

Usage

python cleaning.py
python training.py
streamlit run crime_dashboard.py
python app.py

Flask App Screenshot:

Flask App Screenshot Confusion Matrix Feature Importance Project Banner Learning Curve Output

Dashboard Screenshots

Dashboard Screenshot Dashboard Screenshot Dashboard Screenshot Dashboard Screenshot Dashboard Screenshot Dashboard Screenshot Dashboard Screenshot

Model Performance

Model Accuracy Precision Recall F1-score
XGBoost 0.93 0.93 0.93 0.93
AdaBoost 0.73 0.73 0.73 0.73

Future Work

  • Integrate with a real-time crime dataset.
  • Improve prediction accuracy with ensemble methods.
  • Add geospatial analysis for crime hotspots.
  • Deploy the Flask app on cloud platforms (Heroku, AWS).
  • Add user authentication for secure usage.

Contributing

  • Fork the repository
  • Make your changes
  • Submit a pull request

About the developer

Sarder Junaid Ahmed

Data Scientist & Machine Learning Engineer

Transforming complex data into strategic decisions through rigorous statistical modeling and production-ready machine learning systems.

GitHub LinkedIn Portfolio Email

Specializations: Statistical ML · Causal Inference · Trustworthy AI · Fairness-Aware ML · RAG Systems

Selected Research:

  • 📄 Ahmed, S.J. et al. (2026). Machine Learning for Crime Classification: A Fairness-Aware Approach to Class Imbalance. Journal of Machine Learning and Applications, 2(1), 9–17. DOI: 10.61577/jmla.2026.100002
  • 📄 Ahmed, S.J. et al. (2026). Machine Learning for Crime Classification: A Fairness-Aware Approach to Class Imbalance. IEEE SPICSCON 2026, BAUET, Bangladesh (Aug 13–14, 2026). Accepted for Presentation — IEEE Xplore.
  • 📄 Ahmed, S.J. et al. (2026). CF-EGAT: A Causal Fairness-Aware Equity Graph Attention Network for Country-Level Environmental Livability Classification. SPECTRA 2026. 🏆 1st Best Paper Award
  • 📄 Ahmed, S.J. (2025). Multi-Dimensional Statistical Similarity for Governance Classification: Beyond Arbitrary Thresholds. APMEE 2025. 🏆 Best Research Paper Award
  • 📄 Ahmed, S.J. (2026). DeepEnMap: Ordinal-Aware Multi-Modal Deep Learning for Energy Poverty Risk Mapping. IEMIS 2026, University of British Columbia, Vancouver, Canada (Aug 10–12, 2026). Accepted for Presentation — Springer LNNS Series (Scopus, EI-Compendex, DBLP, ISI Proceedings).
  • 📄 Ahmed, S.J. (2026). Density-Decoupled, Mask-Ablated Segmentation-Guided Diffusion for Controllable Mammography Synthesis: A Preliminary Study. IEMIS 2026, University of British Columbia, Vancouver, Canada (Aug 10–12, 2026). Accepted for Presentation — Springer LNNS Series (Scopus, EI-Compendex, DBLP, ISI Proceedings).
  • 📄 Ahmed, S.J., Islam Nahian, M.T., & Kwoshik, M.H.R. (2026). Environmental Livability Assessment via Adaptive Bootstrap-Retrained SHAP and Statistically-Constrained Pareto Counterfactuals: A Cross-National Analysis. IEEE SPICSCON 2026, BAUET, Bangladesh (Aug 13–14, 2026). Accepted for Presentation — IEEE Xplore.
  • 📄 Ahmed, S.J. (2026). DemocracyGuard: Testing a Divergence-Index Reconciliation of Subjective and Objective Democracy Indicators for Forecasting Adverse Regime Transitions. Under Review, Transactions on Machine Learning Research (TMLR) — Q1, Top-Tier Journal.
  • 📄 Ahmed, S.J. (2026). FAI: Feature-Wise Adaptive Imputation via Downstream-Aware Method Selection. Under Review, ICISET 2026 (IEEE Xplore).

Other Deployed Projects:

  • 🔬 ReproHub — Automated research reproducibility platform with composite scoring across 11 statistical tests
  • 📊 StatsPro — AI-powered statistical analysis platform with automated CSV-to-report workflows

Honors: 🏆 1st Best Paper — SPECTRA 2026  ·  🏆 Best Research Paper — APMEE 2025  ·  🎖️ Esteemed Alumni Award — YLRL RUET 2024  ·  ⭐ Perfect GPA 5.00/5.00 — SSC & HSC  ·  🎓 National Merit Scholarship — 2009 & 2013

License

MIT License

Acknowledgements

  • Scikit-learn
  • XGBoost
  • Streamlit
  • Flask
  • Plotly

About

The Crime Classification Project implements machine learning models to classify crimes into six categories: Murder, Rape, Assault, Body Found, Kidnap, and Robbery. It features an interactive Streamlit dashboard for data visualization and a Flask web application for real-time predictions. Built with XGBoost and AdaBoost classifiers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages