ics5110-crime-statistics

US Crime Analysis: Weapon Use Prediction

Welcome to the Weapon Use Prediction project! This interactive web application leverages machine learning models to predict the type of weapon (Firearm vs. Non-Firearm) used in crimes based on demographic and contextual features. The app is built using Gradio and hosted on Hugging Face Spaces.

Latest code:

🔍 Overview

The primary goal of this project is to analyze crime data and classify weapon usage using machine learning techniques. The application supports multiple models, including:

The models are trained on a publicly available crime dataset, which includes features such as Region, Victim Age, Relationship Type, and more. The dataset is imbalanced - 102,988 records (67.09%) for “Firearm” compared to approximately 50,523 (32.91%) for “Non-Firearm”, and techniques like SMOTE were applied to improve model performance.


🌐 Try It Out

Hugging Face Space

🚀 Features


💻 How to Use

  1. Access the Application:
    • Visit the Hugging Face Space to interact with the app. The iframe below also provides direct access.
  2. Input Features:
    • Select or input values for features like Region, Victim Sex, Relationship Type, etc.
    • Adjust Victim Age using the slider.
  3. Choose a Model:
    • Select a model from the dropdown menu: Random Forest, XGBoost, Logistic Regression, or ANN.
  4. View Predictions:
    • The app displays the predicted weapon category (Firearm or Non-Firearm) along with detailed metrics.

📊 Technical Details

Dataset

Models

Preprocessing