File size: 1,009 Bytes
61b0513
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# SF Crime Prediction App

This is a Streamlit application for predicting crime categories in San Francisco using an XGBoost model.

## Setup

1.  **Install Dependencies**:
    ```bash
    pip install -r requirements.txt
    ```

2.  **Run the App**:
    ```bash
    streamlit run streamlit_app.py
    ```
    Or simply double-click `run_app.bat`.

## Model Info

The app uses `crime_xgb_artifacts.pkl` which contains:
-   XGBoost Model
-   LabelEncoder for Target (Crime Category)
-   FeatureHashers for Address and Description

**Note**: The model expects specific features including hashed Address and Description. Ensure you provide these inputs in the UI for accurate predictions.
**Note**: The District encoder was missing from the provided files, so a default alphabetical mapping is used.

## Deployment

To deploy on the web (e.g., Streamlit Cloud):
1.  Push this code to a GitHub repository.
2.  Sign up for [Streamlit Cloud](https://streamlit.io/cloud).
3.  Connect your GitHub and deploy the app.