Giter Club home page Giter Club logo

crime-prediction's Introduction

K means Clustering

  • Implemented K-means clustering using pyspark
  • Kmeans.py contains the source code

The following commands are used to run the application:

  1. Put the input files and Kmeans.py file in home folder of dsba hadoop cluster using winscp or using the following commands:
	scp Chicago_Crimes_updated.csv [email protected]:/users/sbilgund
    scp Kmeans.py [email protected]:/users/sbilgund
  1. Put the input files in HDFS using the following commands:
	hdfs dfs -put Chicago_Crimes_updated.csv
  1. Change the directory to the folder containing spark-submit:
	cd /usr/lib/spark/bin
  1. Run Kmeans.py for the input files using the commands below:
	spark-submit /users/sbilgund/Kmeans.py Chicago_Crimes_updated.csv
  1. The output is written to folder named ChicagoKmeansOutput. Copy from hdfs to home folder of dsba hadoop cluster using the following command:
	hdfs dfs -copyToLocal ChicagoKmeansOutput /users/sbilgund

Naive Bayes

  • Implemented Naive Bayes using pyspark
  • NaiveBayes.py contains the source code
  • The output of K means is written to multiple files but in the same order as input.
  1. Merge K means output with Chicago_Crimes_updated.csv.
  2. The input to Naive Bayes are in parts named Naive-part-00000.csv, Naive-part-00001.csv, Naive-part-00002.csv
  3. Put the input files and NaiveBayes.py file in home folder of dsba hadoop cluster using winscp or using the following commands:
	scp Naive-part-00000.csv [email protected]:/users/sbilgund
	scp Naive-part-00001.csv [email protected]:/users/sbilgund
	scp Naive-part-00002.csv [email protected]:/users/sbilgund
    scp NaiveBayes.py [email protected]:/users/sbilgund
  1. Put the input files in HDFS using the following commands:
	hdfs dfs -put Naive-part-00000.csv
	hdfs dfs -put Naive-part-00001.csv
	hdfs dfs -put Naive-part-00002.csv
  1. Change the directory to the folder containing spark-submit:
	cd /usr/lib/spark/bin
  1. Run NaiveBayes.py for the input files using the commands below:
	spark-submit /users/sbilgund/NaiveBayes.py 5 11 20

Linear Regression

  • Implemented Linear Regression using pyspark for 2013 and 2014 data
  • LinearRegression.py contains the source code
  • Prints the beta values
  • The model is tested for 2015 data in TestModelRegression.xls

The following commands are used to run the application:

  1. Put the input files and LinearRegression.py file in home folder of dsba hadoop cluster using winscp or using the following commands:
	scp Chicago_Crimes_updated.csv [email protected]:/users/sbilgund
        scp LinearRegression.py [email protected]:/users/sbilgund
  1. Put the input files in HDFS using the following commands:
	hdfs dfs -put Chicago_Crimes_updated.csv
  1. Change the directory to the folder containing spark-submit:
	cd /usr/lib/spark/bin
  1. Run Kmeans.py for the input files using the commands below:
	spark-submit /users/sbilgund/LinearRegression.py Chicago_Crimes_updated.csv

crime-prediction's People

Contributors

dishashetty avatar avnv2201 avatar

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.