henhacks-ud-crime-ai

UD Crime AI - HenHacks 2024

/henhacks-ud-crime-ai

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.

Try it yourself on Binder

Binder

How

Web scraping Data

Cleaning Data

Training the model

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']

Resources

UD Police Stats

Assembly AI Tutorials

SKlearn