A Data Science project focused on analyzing crime incident data, discovering hidden crime patterns, and building machine learning models for crime prediction and clustering.
The project combines data preprocessing, exploratory data analysis (EDA), interactive visualizations, supervised learning, and unsupervised learning to better understand crime distribution across police districts and time.
Crime analysis plays an important role in improving public safety and supporting law enforcement agencies in making data-driven decisions.
This project analyzes historical crime records to answer questions such as:
- Which crime categories occur most frequently?
- How are crimes distributed across police districts?
- Are there seasonal or temporal crime patterns?
- Can machine learning predict the police district of a crime?
- Can similar crime incidents be grouped automatically?
- Clean and preprocess crime datasets.
- Perform exploratory data analysis (EDA).
- Discover temporal and geographical crime patterns.
- Build predictive machine learning models.
- Apply clustering to identify similar crime profiles.
- Evaluate model performance using multiple metrics.
The project uses historical crime incident records containing both numerical and categorical attributes.
- Crime Category
- Police District
- Date & Time
- Day of Week
- Resolution
- Address
- Longitude
- Latitude
Target Variable
Police District (PdDistrict)
Performed comprehensive preprocessing including:
- Combined training and testing datasets
- Removed duplicate records
- Renamed geographical columns
- Converted dates into datetime format
- Extracted temporal features:
- Year
- Month
- Day
- Hour
- Checked missing values
- Prepared categorical features for machine learning
Performed extensive EDA to better understand crime trends.
Analysis included:
- Crime category distribution
- Crime frequency by police district
- Crime trends over time
- Crime resolution analysis
- Geographic crime distribution
- Outlier detection
- Feature statistics
Created multiple visualizations including:
- 📊 Bar Charts
- 📈 Line Charts
- 🥧 Pie Charts
- ☁️ Word Cloud
- 📍 Geographic Scatter Maps
- 📦 Boxplots
- 📚 Stacked Bar Charts
These visualizations helped identify crime hotspots, temporal trends, and district-level crime behavior.
Built a multi-class Logistic Regression model to predict the Police Department District.
Preprocessing included:
- Label Encoding
- MinMax Scaling
Evaluation Metrics
- Accuracy
- Precision
- Recall
- F1 Score
- Confusion Matrix
- Classification Report
Implemented K-Medoids Clustering to discover hidden crime patterns.
The clustering workflow included:
- Gower Distance for mixed numerical and categorical features
- Optimal cluster selection using Silhouette Score
- Cluster quality evaluation using:
- Silhouette Score
- Calinski-Harabasz Index
- Davies-Bouldin Index
Representative crime profiles were identified through cluster medoids.
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Plotly
- WordCloud
- Scikit-Learn
- Scikit-Learn-Extra
Algorithms
- Logistic Regression
- K-Medoids Clustering
Preprocessing
- Label Encoding
- MinMaxScaler
Distance Metric
- Gower Distance
- Data Cleaning
- Exploratory Data Analysis
- Feature Engineering
- Machine Learning
- Multi-Class Classification
- Clustering
- Geospatial Data Analysis
- Statistical Analysis
- Data Visualization
- Model Evaluation
✅ Successfully analyzed crime incidents across multiple police districts.
✅ Identified temporal and geographical crime patterns.
✅ Built a multi-class Logistic Regression classifier.
✅ Applied K-Medoids clustering to identify similar crime profiles.
✅ Evaluated clustering quality using multiple validation metrics.
- Compare additional classification models (Random Forest, XGBoost, LightGBM).
- Build an interactive crime dashboard using Streamlit.
- Integrate real-time crime datasets.
- Apply deep learning techniques for crime prediction.
- Develop crime hotspot forecasting using time-series models.