I have a data set which has thousands of rows of {latitute, longitude, crime-type} tuples.

Sample Data:

41.757366519   -87.642992854   THEFT
41.910469677   -87.585822373   ROBBERY
41.751270452   -87.690708662   BURGLARY
41.757366519   -87.642992854   THEFT
41.757366519   -87.642992854   THEFT
..             ..              ..
..             ..              ..

I am trying to cluster these based upon the crime types.

For example, if in any region, THEFT has a high frequency of occurrence, based on the data set, it should show up as a cluster. I have tried clustering using the lat-long data only, and that does not seem to have any meaning for this crime dataset.

I am fairly new to data mining, and gradually figuring my way out.

How can I cluster the data using the latitude and longitude values based such that the clusters are related to each other through the crime-type? Is there any tool available that can use the lat-long data and cluster them on the crime-type basis? Otherwise, I can even write a script once I understand how this can be done.

Also, has anyone had any previous experience in crime-data-mining? In what other ways can I find interesting patterns from a crime data-set?

Thanks a lot!

  • $\begingroup$ Reminds me of a certain Kaggle contest... ;) $\endgroup$ – Hack-R Mar 8 '16 at 3:52

There is no meaningful way to combine "type" with a distance in meters.

My suggestion is that you:

  1. split the data set by type.
  2. cluster each type, with DBSCAN, haversine distance, and the same minpts/eps values for each crime type
  3. compare the resulting clusters for similarity and differences

I'm not pretty sure about what is the final objective of doing this.

Nevertheles, I have some ideas. You could hash or dict the crime type (asign a number to each class) and then do clustering.

Or given a couple [lat, long] you could use an algorithm (like KNN) to predict which crime type is "most probable" to be.

  • $\begingroup$ Could you please elaborate on this? If I assign a number to each crime, what would the clustering be based on? How will I be able to include both the number as well as the lat-long information while clustering? $\endgroup$ – ankita Mar 9 '16 at 3:12
  • $\begingroup$ Also, could you please explain the second approach using KNN? Thanks in advance :) $\endgroup$ – ankita Mar 9 '16 at 3:13
  • $\begingroup$ If you assign a number, i.e., make a dict with the crime type, you have a 3 dimension vector and now you can do clustering with the data "itself". I recommend you K nearest neighbors because its very easy to understand, but it could be any classification algorithm. KNN on Wikipedia $\endgroup$ – pgalilea Mar 9 '16 at 12:09

Separate the training data according to every possible value of crime type and form chunks and after that apply K-mean clustering for longitude and latitude on each separate chunk.

Ex, if possible crime type is "murder" and "burglary".

Then separate data in which "murder" is crime type and "burglary" is crime type.

Now you have two chunk of data. So apply K-Mean clustering on each chunk.

  • $\begingroup$ Don't use k-means on latitude/longitude, and also not on categorical data. $\endgroup$ – Has QUIT--Anony-Mousse Mar 7 '16 at 20:13
  • $\begingroup$ Why we can not use that? Is there any constraint not to use them. $\endgroup$ – Bhagyesh Vikani Mar 8 '16 at 2:25
  • 1
    $\begingroup$ Because the mean of -179 and +179 is 0. It will fail to find the optimum center (it is also off in many other places, just not that completely off). It may even fail to converge and go into an infinite loop. $\endgroup$ – Has QUIT--Anony-Mousse Mar 8 '16 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.