the4thparadigm / denvercrime

Analysis of Denver crime data by the 4th Paradigm student organization.
GNU General Public License v3.0
2 stars 2 forks source link

Feature Engineering: Create response variable function #28

Open fouticus opened 5 years ago

fouticus commented 5 years ago

Ultimately, we will build a predictive model for dates and locations, so given a date and neighborhood, the model will predict how many incidents of each offense category will occur on that date in that neighborhood. To make this prediction, the model will use past information about the incidents that occurred in and around the neighborhood. To train and test this model, we need two things:

  1. A function which takes in a date and neighborhood and counts how many incidents occurred on that date in that neighborhood. These will be the "response variables" for our model. The output should be a pandas series where each element is the count for a different offense category for that neighborhood/date

  2. A function which takes in a date and neighborhood and generates statistics about what happened prior to that date and relative to that neighborhood. These will be the "predictor variables" for our model. For example, given "("March 1st, 2019", "Stapleton"), generate counts of the number of incidents on the previous day, the previous week, the previous month, on the day one week prior, two weeks prior, one year prior, etc. Do this for each offense category separately, then all incident types combined, then for traffic incidents, then for criminal incidents, then for non-traffic/non-criminal incidents. Repeat this process for the neighborhood of interest (Stapleton), then for the city overall, then for adjacent neighborhoods. The sky is the limit here. Suggestion: start with "For each offense category, how many occurred in the prior day (Feb 28th)"? Then do the same for the prior week. The output should ge a pandas series where each element is the count for a different combination of date, offense type, and location.

For this issue: Create function (1)

dawsoneliasen commented 5 years ago

Edit src/utils/features/make_features.py