Inspiration

When we first saw the list of potential topics for our project, the idea of enhancing public safety through optimized patrol routes immediately caught our attention. Growing up in Singapore, we were always intrigued by the meticulous and efficient way the Singapore Police Force patrols public transport systems. The visible presence of police officers in MRT stations and buses, and the strategic manner in which they conduct their patrols, made a lasting impression on us.

We often wondered about the strategies and data-driven decisions behind these patrols. How do they decide where and when to patrol? What technologies and methodologies do they use to ensure the safety of commuters? These questions fueled our curiosity and inspired us to explore how data analysis and machine learning could be applied to optimize patrol routes and enhance public safety.

This project became a way for us to channel our fascination with the Singapore Police Force's patrol strategies into a meaningful initiative. By combining our interests in data science, machine learning, and public safety, we aimed to create a tool that provides actionable insights for law enforcement agencies, ultimately contributing to safer communities.

What it does

Our solution directly addresses the problem statement by integrating crime data analysis with patrol route optimization, aiming to enhance domestic security. We have conducted the analysis using Atlanta's crime data, however by adopting this with Singapore's data, we may analyze Singapore's crime hotspots to strategize patrol routes and resource allocations.

  1. Crime Hotspots Analysis

Heatmap Generation: We generated a heatmap of crime incidents in Atlanta, highlighting areas with higher crime rates. This visual representation helps in identifying hotspots that require more attention. K-Means Clustering: By applying the k-means clustering algorithm, we identified 9 centroids, each representing a high-crime area. These centroids serve as focal points for further analysis and patrol route planning. Local Maximum Identification: Within each cluster, we pinpointed local maxima of crime rates to identify specific hotspots. These hotspots, along with the centroids, serve as critical nodes for patrol routes.

  1. Patrol Route Optimization

Ant Colony Optimization (ACO): Using ACO, we computed the optimal patrol routes within each cluster. This algorithm mimics the foraging behavior of ants to find the shortest paths, ensuring that patrol units can efficiently cover high-crime areas, thereby reducing emergency response times and enhancing police presence where it is most needed.

  1. Predictive Analysis

Decision Tree for Crime Prediction: We built a decision tree model to predict crime occurrences based on factors such as weather conditions (temperature and precipitation), time of year, and existing crime rates. This allows us to forecast potential crime hotspots and types of crimes, enabling proactive deployment of resources. Dynamic Heatmap Construction: By integrating real-time weather data and historical crime data, we can dynamically update the heatmap to reflect current risk levels, ensuring law enforcement agencies can adjust their patrol strategies accordingly.

How we built it

Our hack was built using a combination of data analysis, machine learning algorithms, and optimization techniques. Here are the detailed steps we followed:

  1. Data Collection and Preprocessing

Crime Data: We obtained a dataset of crime incidents in Atlanta, including attributes such as location, type of crime, and data of occurrence. Weather Data: We sourced historical weather data API to include temperature and precipitation, which are used as input features for our prediction model.

  1. Heatmap Generation

We plotted the crime data on a map of Atlanta, using color intensity to represent crime frequency. Darker spots indicate higher crime rates, making it easier to visualize hotspots.

  1. K-Means Clustering

Using the within sum of squares (WSS) method, we determined that 9 clusters would best represent the data. We applied the k-means algorithm to find these 9 centroids, which indicate high-crime areas. We iterated through each data point to assign it to the nearest centroid, forming clusters around these centroids.

  1. Local Maxima Identification

Within each cluster, we performed a local analysis to identify peaks in crime rates, marking these as additional hotspots.

  1. Ant Colony Optimization (ACO)

We modeled the patrol route optimization problem as a graph, where nodes represent centroids and local maxima. We implemented the ACO algorithm to find the shortest and most efficient patrol routes that cover all high-risk nodes in each cluster.

  1. Decision Tree Model

We trained a decision tree using features like weather conditions, time of year, and historical crime data to predict the likelihood of future crimes. This model helps in estimating the risk levels for different locations and times, aiding in dynamic resource allocation.

  1. Integration and Visualization

We combined the heatmap, clustering results, optimized patrol routes, and predictive model outputs into a unified dashboard. This dashboard provides law enforcement agencies with real-time insights into crime hotspots, optimal patrol routes, and predicted crime risks.

By leveraging data analytics, machine learning, and optimization techniques, our hack not only identifies high-risk areas but also provides actionable insights and optimized patrol strategies to enhance domestic security effectively.

Challenges we ran into

Frontend Development: Our team lacked experience in frontend and UI/UX design, which made building our website for presenting our ideas a significant challenge. We had to quickly learn and implement web development skills to create a user-friendly and visually appealing interface.

Data Availability: We initially aimed to find datasets on Singapore's crime incidents, including details such as locations, dates, and types of crimes. However, we discovered that this information was not readily available online. The Singapore datasets available online did not include data such as longitude and latitude that was critical for our analysis. As a result, we decided to use a dataset of crimes in Atlanta to perform our analysis and develop our solution.

Uploading Shiny R to the Cloud: Deploying our Shiny R application to the cloud proved to be a significant technical challenge. We encountered various issues related to configuration and compatibility, which required us to troubleshoot and adapt our approach multiple times before successfully getting the app online.

Making Our Website Publicly Available: Ensuring that our website was publicly accessible posed its own set of challenges. We had to navigate through the intricacies of hosting services, configuring domain settings, and ensuring that all parts of our site were correctly deployed and accessible to the public.

Accomplishments that we're proud of

Effective Data Usage: We invested a lot of effort into determining the best way to analyze the dataset. We successfully applied several algorithms and machine learning techniques, including k-means clustering, decision trees, and the ant colony optimization algorithm. These methods allowed us to extract valuable insights from the limited data we had, making our analysis thorough and impactful.

Completing Our Project: This hackathon was a first for all team members, and we started with little idea of what to expect. We are proud that we managed to build a fully functional product that effectively represents our ideas for solving the problem statement. Completing the project under these circumstances was a significant achievement for us.

Overcoming Technical Challenges: Despite our initial lack of experience with certain technologies, we successfully learned and implemented the necessary skills. From frontend development to cloud deployment, overcoming these hurdles has been a significant achievement and has greatly expanded our technical capabilities.

What we learned

Participating in this hackathon has been an incredibly enriching experience for us, especially since this is our first hackathon.

Firstly, we gained hands-on experience in applying machine learning techniques to real-world problems. From data preprocessing and clustering to building predictive models, we saw firsthand how these technologies can be leveraged to derive actionable insights and improve decision-making processes.

In addtion, working together as a team allowed us to pool our diverse skills and perspectives, leading to a more innovative and effective solution. We learned how crucial teamwork and clear communication are in tackling complex problems.

Furthermore, applying our project to a real-world context, specifically law enforcement, highlighted the practical challenges and considerations in deploying technological solutions. We learned to balance technical feasibility with usability and impact.

Lastly, we were exposed to new tools and technologies throughout the hackathon, enhancing our technical skill set. Learning to quickly adapt and utilize these tools was a key takeaway that will benefit us in future projects.

What's next for ScratchTheCat

After the hackathon, our journey does not end here; in fact, it marks the beginning of an exciting new chapter. Building on the foundation we've laid during this project, we have several plans to further develop and refine our solution.

First, we will work on integrating real-time data feeds, such as live weather updates and real-time crime reports, into our system. This will enable dynamic adjustments to patrol routes and enhance the predictive accuracy of our models.

Next, While our initial analysis focused on Atlanta, we plan to adapt and test our solution in other cities, including Singapore. Each city has unique crime patterns and challenges, and we aim to customize our solution to meet these specific needs.

Additionally, we intend to develop a more comprehensive and user-friendly dashboard that law enforcement agencies can use with ease. This includes interactive maps, real-time alerts, and detailed analytics to support decision-making.

Finally, we commit to a cycle of continuous improvement. By regularly updating our models, incorporating new data, and responding to feedback from users and stakeholders, we will ensure that our solution remains effective and relevant.

Built With

Share this project:

Updates