Crime Rate Predictor
The Crime Rate Predictor Using Machine Learning is a machine learning-based project developed to analyze and forecast crime trends across major Indian cities. The project uses historical crime records to identify patterns and predict future crime rates.
Crime prevention and public safety are important concerns for governments and law enforcement agencies. Traditional crime monitoring methods often depend on manual reporting, surveys, and reactive approaches. By using historical data and machine learning techniques, this project provides a way to analyze previous crime patterns and generate predictions for future years.
The Crime Rate Predictor focuses on 19 metropolitan cities in India and uses official crime data to identify trends across different crime categories. The predictions can help with resource planning, risk management, and proactive crime prevention.
Crime Rate Predictor – Project Overview
The project applies machine learning techniques to historical crime records collected from the Indian National Crime Records Bureau (NCRB). The dataset covers crime statistics from 2014 to 2021.
Users can select a city, crime category, and year through the application interface to generate a predicted crime rate. The system processes these inputs using a trained Random Forest Regression model and displays the predicted result.
| Project Detail | Information |
|---|---|
| Project Name | Crime Rate Predictor |
| Languages Used | Python, HTML, CSS, JavaScript |
| Machine Learning Model | Random Forest Regression |
| Framework | Flask |
| Library | Scikit-learn |
| Database | Excel Dataset |
| Project Type | Web Application |
Dataset Information
The Crime Rate Predictor uses crime data collected from the National Crime Records Bureau (NCRB). The dataset contains historical crime statistics covering the period from 2014 to 2021.
The project analyzes crime information for 19 metropolitan cities in India. Historical records are used to identify trends and patterns that can be processed by the machine learning model for future predictions.
Crime Categories Covered
The system supports prediction for 10 major crime categories:
- Murder
- Kidnapping
- Crime Against Women
- Crime Against Children
- Juvenile Crimes
- Crime Against Senior Citizens
- Crime Against Scheduled Castes (SC)
- Crime Against Scheduled Tribes (ST)
- Economic Offenses
- Cybercrimes
By analyzing these categories individually, the application can provide category-specific crime rate predictions based on the selected city and year.
Machine Learning Methodology
The project follows a standard machine learning workflow to transform historical crime data into useful predictions.
1. Data Collection and Cleaning
The first stage involves collecting historical crime records from NCRB data. The records are structured for analysis, missing values are treated, and irrelevant columns are removed before the data is used for model training.
2. Exploratory Data Analysis
Exploratory Data Analysis is performed to understand crime trends and patterns. Visualizations such as bar charts, heatmaps, and line graphs can be used to examine the historical crime data.
3. Feature Engineering
Time-based information and city identifiers are extracted from the dataset to provide useful input features for the machine learning model.
4. Model Training
Machine learning algorithms are applied to the prepared dataset. The project uses Random Forest Regression as its main prediction model.
5. Model Evaluation
The prediction model is evaluated using accuracy and regression metrics such as R², RMSE, and MAE. The project reports a prediction accuracy of 93.20% on the testing dataset.
Random Forest Regression Model
The Crime Rate Predictor is built using the Random Forest Regression model from the Scikit-learn library.
Random Forest Regression is an ensemble learning technique that creates multiple decision trees and combines their predictions. By averaging the predictions generated by multiple trees, the model can reduce errors and provide more reliable predictions than relying on a single decision tree.
For this project, the Random Forest Regression model analyzes historical crime trends to predict crime rates based on the selected inputs.
Model Overview
| Specification | Details |
|---|---|
| Algorithm | Random Forest Regression |
| Inputs | Year, City Name, Crime Type |
| Prediction Accuracy | 93.20% on the testing dataset |
| Data Source | NCRB crime reports (2014–2021) |
Key Features
1. Crime Rate Prediction
The application can predict crime rates for the supported crime categories using the trained machine learning model.
2. 19 Metropolitan Cities
The project covers 19 Indian metropolitan cities, allowing users to generate city-specific crime rate predictions.
3. 10 Crime Categories
Users can select from 10 major crime categories, including murder, kidnapping, crimes against women and children, cybercrimes, economic offenses, and other supported categories.
4. Historical Crime Data Analysis
The system uses historical crime records from 2014 to 2021 to identify trends and patterns before generating predictions.
5. User-Friendly Interface
The project provides a simple web interface where users can select the city, crime type, and year for which they want to generate a prediction.
6. Data-Driven Insights
The predicted results can provide data-driven insights that may assist law enforcement planning, resource allocation, and crime trend analysis.
How the Application Works
The Crime Rate Predictor follows a simple input-and-prediction workflow.
- Select City: Choose one of the supported 19 metropolitan cities.
- Select Crime Type: Select one of the 10 available crime categories.
- Select Year: Enter the future year for which the crime rate needs to be predicted.
- Generate Prediction: Click the prediction button to generate the estimated crime rate.
- View Result: The predicted crime rate is displayed through the application interface.
Applications of the Crime Rate Predictor
Law Enforcement
The system can help law enforcement agencies analyze historical crime patterns and identify areas where certain crime categories may require additional attention. Predicted trends can support patrol planning and resource allocation.
Government Agencies
Government agencies can use data-driven crime forecasts as an input for planning policies and safety improvement initiatives.
Researchers and Students
The project provides students and researchers with a practical example of how machine learning can be applied to real-world social problems. Historical crime data can be analyzed to study trends and patterns.
NGOs and Social Workers
Crime predictions can help NGOs and social workers understand areas where particular types of crime may increase and plan awareness activities accordingly.
Real-World Impact
The Crime Rate Predictor is designed as a data-driven tool for understanding crime patterns and supporting proactive planning.
- Police Departments: Identify crime-prone areas and deploy resources effectively.
- Government Authorities: Develop policies aimed at reducing crime and improving public safety.
- Researchers and Analysts: Analyze crime trends and study their societal impact.
- Public Awareness: Help users understand crime risks and historical patterns in different cities.
Technology Stack
| Technology | Purpose |
|---|---|
| Python | Backend logic, model training, and prediction processing |
| Flask | Web application framework |
| Scikit-learn | Machine learning and Random Forest Regression |
| HTML | Web page structure |
| CSS | Interface styling |
| JavaScript | Web page interaction |
| Excel Dataset | Storage of NCRB crime statistics |
How to Run the Project
The Crime Rate Predictor can be run using Visual Studio Code and Python.
Step 1: Open Visual Studio Code
Launch Visual Studio Code on your computer.
Step 2: Open the Project Folder
Use File > Open Folder and select the extracted Crime Rate Predictor project directory.
Step 3: Install Dependencies
Open the terminal inside Visual Studio Code and install the required Python packages using:
pip install -r requirements.txt
Step 4: Start the Application
After installing the required dependencies, run the Flask application using:
python app.py
Step 5: Access the Application
Once the application starts successfully, open the local server link provided in the terminal in your web browser.
Screenshot:-



How to Download
Get This Project
The complete package is available so you can run, study, and submit it with confidence. It includes:
- Full Source Code
- Project Report
- Synopsis
- PPT Presentation
For any queries or a quick response, reach out on WhatsApp: +91 79834 34684
Future Enhancements
The project can be enhanced further with additional functionality mentioned in the original project description.
- Live Crime Data Integration: Integration with live crime data for real-time predictions.
- Interactive Data Visualization: Interactive heatmaps and trend analysis for better visualization of crime patterns.
- Crime Hotspot Detection: Geospatial mapping for identifying crime hotspots.
Conclusion
The Crime Rate Predictor Using Machine Learning is a practical Python-based web application that demonstrates how historical crime data can be analyzed and used to predict future crime rates.
Using Random Forest Regression, NCRB crime data from 2014 to 2021, 19 metropolitan cities, and 10 major crime categories, the application provides a simple interface for generating crime rate predictions.
The project combines Python, Flask, Scikit-learn, HTML, CSS, and JavaScript to create a machine learning web application that can be useful for students, researchers, and developers interested in machine learning and real-world data analysis.
Keywords: crime rate predictor using machine learning, crime rate prediction using python, crime prediction using machine learning, crime rate prediction project, crime prediction project in python, crime rate prediction using random forest, crime prediction using machine learning python, crime rate predictor project, machine learning crime prediction, crime rate prediction source code