Coder Social home page Coder Social logo

shanbhag10 / crime-predictor-chicago Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 12.69 MB

One of the most important questions people ask before moving to a new place or traveling is: Is this locality safe? We answer this question using co-location pattern mining. Our crime predictor gives the possibility of all crimes that can happen given the presence of certain geographical entities and certain crimes in the locality. Given a set of boolean spatial features, the co-location pattern discovery process finds the subsets of features frequently located together. We have used a transaction free approach for this using Haversine distance as a metric for finding proximity neighborhood and measuring all spatial autocorrelations. We also propose an improvement to distance measure approach while calculating R-proximity neighborhood using boundary window. We used distance and participation thresholds for determining the correlation between features and crimes. Our algorithm exploits the anti-monotone property and optimizes the co-location pattern discovery algorithm by prevalence based pruning.

Home Page: https://drive.google.com/open?id=1CFsYQRAEYG0MNZv7T6wbJnsA_6lREAIq

Python 100.00%

crime-predictor-chicago's Introduction

Crime Predictor: Chicago

Pre-requisites

STEP 1: Clone the repository

Please run the command git clone https://github.com/shanbhag10/Crime-Predictor-Chicago.git

STEP 2: Change the directory to scripts

Please run the command cd <PATH_OF_CLONE_FOLDER>/Crime-Predictor-Chicago/scripts

STEP 3: Pre process raw data [ONLY IF REQUIRED]

Please run the command python3 preProcessData.py ../config/<PRE_PROCESS_FILE>.config ../config/<MAIN_PROCESS_FILENAME>.config

Example:

python3 preProcessData.py ../config/preprocess_all.config ../config/main.config

The structure of <PRE_PROCESS_FILE>.config is as follows

First Line: <OUTPUT_FILE_FOR_MAIN_ALGO> Second Line<RAW_FILE_PATH>,<ROW_FILTER_KEY>,<COL_NAME_HAVING_THE_FILTER_KEY>,<COL_NAME_FOR_LATITUDE>,<COL_NAME_FOR_LONGITUDE>

For multiple files put each entry on a new line

NOTE: The ROW_FILTER_KEY and COL_NAME_HAVING_THE_FILTER_KEY can be empty if you don't want to filter rows

Example content:

../data/input/allFeatures.csv
../data/overlap/crime.csv,HOMICIDE,PRIMARY DESCRIPTION,LATITUDE,LONGITUDE
../data/overlap/bars.csv,,,LATITUDE,LONGITUDE
../data/overlap/church.csv,,,"LAT","LONG"
../data/overlap/library.csv,,,LAT,LONG
../data/overlap/school.csv,,,Lat,Long
../data/overlap/police.csv,,,LATITUDE,LONGITUDE

STEP 4: Create the <MAIN_PROCESS_FILENAME> [ONLY IF Pre processing step is skipped]

Create a file <MAIN_PROCESS_FILENAME>.config in the config directory with the names of clean combined input file separated by ','

Example Content:

../data/input/allFeatures.csv

Please make sure that the file above only has a UID, latitude, longitude and Feature values for each record for the corresponding feature in a new line

Example input file content: ../data/input/allFeatures.csv

1,41.86922,-87.66249,bars
2,41.86923,-87.66249,bars
3,41.86921,-87.66248,school
4,41.86923,-87.66248,school
5,41.86920,-87.66247,police

STEP 5: Run the Main algorithm

Run the following command

python3 colocationAlgo.py ../config/<MAIN_PROCESS_FILENAME>.config > ../data/output/<OUTPUT_FILE_NAME>.txt

Example:

python3 colocationAlgo.py ../config/main.config > ../data/output.txt

crime-predictor-chicago's People

Contributors

cj8664 avatar shanbhag10 avatar prashanth261993 avatar

Stargazers

 avatar  avatar poseidon avatar

Watchers

 avatar  avatar  avatar

Forkers

cj8664 devi2k20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.