Skip to content

Can we predict when crime will happen in Minneapolis? We gave it a shot using machine learning and time-series forecasting.

Notifications You must be signed in to change notification settings

bmeulebroeck/Minneapolis-Crime-Prediction

Repository files navigation

Minneapolis Police Incident Analysis

The goal of this project was use crime incident data from 2010-2020 to develop machine learning models that could be used to predict crime incident rates in the future.

Analysis can be viewed by clicking HERE

Models

  1. b_model.ipynb
    a. Tests features in a naive bayes model and a deep learning neural network model
  2. b_prophet.ipynb
    a. Uses fbprophet library to analyze incident data and develop a forecast
    b. Outputs trend by year and by week of the year for analysis
    c. Outputs interactive plotly reports as html
  3. b_time_series_final.ipynb
    a. Uses simple moving average to develop trend models for weekly incident forecasts
    b. Evaluates total incident count, incidents by neighborhood, and incidents by offense
  4. b_time_series_test.ipynb
    a. Notebook used to test variations on simple moving average forecasting
  5. randomforest_abp.ipynb
    a. Random Forest model to predict ucrCode
    b. Generates a Top 10 Features barchart
    c. Generates a Tree Plot of the model
    d. Performs hyperparameter tuning using GridSearchCV.
  6. GJeter_RFM_highest_crime_neighborhood.ipynb
    a. Random forest model focused on the highest crime rate neighborhood in Minneapolis - Downtown West
  7. GJeter_RFM_nieghborhood.ipynb
    a. Random forest model to identify in which neighborhood crime is most likely to occur.

Visualizations

  1. Tableau Crime Rate Story
    a. Visualizes crime trends for each UCR category
  2. Tableau Crime Heat Map
    a. Heat map that shows crime density by year for each UCR category
  3. Leaflet.js Cluster Group Map
    a. Loads Data from the GeoIncident.json file created by the csv_geojson.py app.
    b. Loads Minneapolis neighborhood shape data from the Minneapolis_Neighborhoods.geojson file which was downloaded from opendata.minneapolismn.gov.
    c. Creates a ClusterGroup of the incident markers
    d. Creates a polyline of the neighborhood markers
    e. Marker includes case number, neighborhood, crime, and date of incident popup.

Misc

  1. incident_data/data_clean.ipynb
    a. Cleans the incident csv files and combines them into one csv file.
  2. b_eda.ipynb
    a. Imports incidents file for exploratory data analysis to identify trends in the data
  3. csv_geojson.py
    a. Creates a geojson file of the combined incident data.
  4. csv_to_html.ipynb
    a. Creates html files of interactive Plotly visualizations.

Links

Open Data Minneapolis
Incident Analysis on Tableau Public

About

Can we predict when crime will happen in Minneapolis? We gave it a shot using machine learning and time-series forecasting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published