Generative Machine Learning model trained on UD Police Daily Statistics from 2017-2021. When provided a LOCATION, DATE, & TIME it generates a prediction of what crime description may be committed.
Web scraping Data
Cleaning Data
Trabant Student Center
& Trabant Building
:
removedTraining the model
sklearn
the model was trained on a DecisionTreeClassifier()Getting Predictions
# Predict Crime Description for given Location and date/time
sample_location = "Smith Hall"
sample_time = 1200
sample_day = 3
sample_month = 5
sample_year = 2024
sample_location_encoded = label_encoders["Location"].transform([sample_location])[0]
predict_description = clf.predict([[sample_time, sample_location_encoded, sample_day, sample_month, sample_year]])
# Print the inverse encoding (readable text)
print(label_encoders["Description"].inverse_transform(predict_description))
Output: ['Trespass']