1
$\begingroup$

I have this 250k data set with these features

    date_time       FullAddress             call_type priority   lat       long
0   6/14/17 21:54   10 14TH ST\, San Diego\, CA 1151    2.0 32.705449   -117.151870
1   3/29/17 22:24   10 14TH ST\, San Diego\, CA 1016    2.0 32.705449   -117.151870
2   6/3/17 18:04    10 14TH ST\, San Diego\, CA 1016    2.0 32.705449   -117.151870
3   3/17/17 10:57   10 14TH ST\, San Diego\, CA 1151    2.0 32.705449   -117.151870
4   3/3/17 23:45    10 15TH ST\, San Diego\, CA 911P    2.0 32.705722   -117.15035

Date and time , full address , lat and long , and call type , and level of the seriousness of the crime. I want to predict the time when Future crimes will happen or predict the location it will happen again. How can I make that happen, will I use regression or classification? I already predicted the priority, but how can I predict the time it will happen or the location?

I predicted the priority but doesn't really give me anything. I want to predict time and location or either or.

this is some code i have for my priority prediction

from sklearn.ensemble import RandomForestClassifier
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
my_RandomForest = RandomForestClassifier(n_estimators=100, random_state=0)

my_RandomForest.fit(X_train, y_train)
y_predict_fr = my_RandomForest.predict(X_test)
from sklearn.metrics import accuracy_score
print(y_predict_fr)
accuracy_fr = accuracy_score(y_test, y_predict_fr)
print(accuracy_fr)

[4. 3. 2. ... 3. 1. 2.]
0.95100761598545
$\endgroup$

2 Answers 2

1
$\begingroup$

Also I would say think about the implications of your model (even if it is just some toy data).

If your model has overtly data from one location and not the other you might end up introducing some bias in your data - some crimes are not always known to the authorities. Crime is a very complex topics are your features relevent to the problem? Maybe some other features should be in the dataset and they are not?

Models applied in "high stake scenarios" often discussed on topics such as the fairness of AI should be very carefully validated. Once again that is just some toy data, but I thought it was noteworthy.

$\endgroup$
0
$\begingroup$

So, remember the uses of Regression and Classification. Basicaly if you want o predict a discrete variable you should use classification, if you want to predict a continuous variable you should use regression. You can also use Regression for discrete variables if you quantize it after using some threshoulding method or something like that.

  • Time and location are continuous variables, you will predict them with Regression.

  • Call_type is a discrete variable, you will predict it with Classification.

  • Full address is dependent on lat and long, you should probably remove this from your model.

$\endgroup$
3
  • $\begingroup$ It might make sense for OP to bin location into regions (streets, districts etc) in which case the transformed feature would fall under classification. $\endgroup$
    – iacob
    Apr 3, 2019 at 14:08
  • $\begingroup$ The problem in that is that it will generate too many classes and lat and long can be mapped back into regions $\endgroup$ Apr 3, 2019 at 14:13
  • $\begingroup$ But, yes if want to go that way it is totally valid $\endgroup$ Apr 3, 2019 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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