# How do I predict the occurrence of rare events?

I am trying to predict crime. I have data with factors: location, keyword description of the crime, time crime occurred and so on. This is for crimes that occurred in the past.

I would like to treat the prediction of crimes as a binary classification problem. In this model, the data I have collected would form the "positive" examples: they are all examples of a crime happening. However, I am unsure what to use for the negative examples.

Obviously, most of the time there is no crime at the location, but can I use this as negative data? For example, if I know there was a crime at 7pm at location X, and no other crimes there, should I generate new negative data points for every hour except 7pm?

Ideally, I want to create probabilities of crime based on a set of factors.

## 2 Answers

It might be more informative to:

1. Label each combination of location, type, and time of crime with a crime rate. For example, theft, in Crystal City, at 11pm at night, occurs 20 times per year, or 0.4 times per resident per year.

2. Predict the crime rate, rather than individual events.

This avoids the need to have explicit examples of "non-crime", and lets you instead directly learn something related to the probabilities of crimes being committed (the rate).

• That makes sense. Do not know if I have enough data for that. Many thanks. Oct 29 '19 at 11:37
• This is hardly useful. That rate will be 0 most of the time, which corresponds to having explicit examples of "non-crime". Oct 30 '19 at 8:22
• @jan-glx That will depend to a great degree on the timescale you look at. Using, say, the yearly rate, will yield non-zero statistics for most kinds of crime for the size of areas these surveys usually cover (neighborhoods; police districts). I have used this technique myself, and seen others use it specifically with crime data, with good effect. Oct 30 '19 at 12:00
• You are asking to bin the data in bins that are so wide that most of bins are non-zero. Possible, sure, but then one won't be able to make use of all the features: keyword description of the time, time of the crime, location they span a space so large, there won't possibly be as many crimes. the approach you describe is useful if you want to predict crime based on features of the area but not if you want to use features of the crime. Oct 31 '19 at 12:47

I would go so far as to say that unless the training examples include predicate data- that is, data about conditions leading up to a crime or non-crime-, then you cannot have enough information to predict the occurence of a crime from conditions or events that happen in advance of a potential crime not yet committed.

• This doesn't seem highly likely, and in fact, I have seen people use this kind of data to predict the probability that a crime will occur. In fact, it is likely you already do this yourself. For instance, where would you rather be at 3am: An affluent suburb, or the "bad part" of your town? Oct 30 '19 at 12:04
• Are you saying that the training data can just include spatial data and other such information that is only available at the immediate time of the crimes? I suppose that's true. A crime map of a city and no other information would give a valid basis for estimating future likelihood of crimes at various places in the city; and adding the times that the crimes occurred would make it possible to predict, e.g., that it is risky to walk alone at 3am Sunday morning in a particular neighborhood. So I agree. I won't delete my answer because it plus these comments might be useful to someone. Oct 30 '19 at 14:53