XGBoost โ Fentanyl Overdose Rate Forecasting
Author: Ansh Gupta
Overview
An XGBoost regression model for forecasting census tract-level fentanyl/opioid overdose rates in King County, Washington. The model integrates American Community Survey (ACS) census data, Group-Based Trajectory Modeling (GBTM) cluster assignments, and historical overdose rates to predict future overdose rates per 100,000 population.
Performance (5-Fold Cross-Validation)
| Metric | Value |
|---|---|
| Rยฒ | 0.923 |
| MAE | 5.79 per 100,000 |
| RMSE | 9.47 per 100,000 |
| Spearman ฯ | 0.929 |
| Top-10 Overlap | 90.0% |
| BPR K=10 | 100.0% |
| Top-20 Overlap | 100.0% |
| BPR K=20 | 100.0% |
| Top-50 Overlap | 86.0% |
| BPR K=50 | 98.0% |
| Mean BPR (K=5โ200) | 97.6% |
Features
| Feature | Description |
|---|---|
| Med_HHD_Inc_Thousands_ACS__ | Median household income (thousands) |
| pct_Renter_Occp_HU_ACS__ | % renter-occupied housing units |
| pct_Vacant_Units_ACS__ | % vacant housing units |
| pct_Not_HS_Grad_ACS__ | % without high school diploma |
| pct_College_ACS__ | % with college degree |
| pct_NH_Blk_alone_ACS__ | % non-Hispanic Black population |
| Pct_No_Health_Ins_CALCULATED_ACS__ | % without health insurance |
| Med_HHD_Inc_Thousands_ACS___Neighbor_Avg | Average median income of 3 nearest neighbor tracts |
| pct_Vacant_Units_ACS___Neighbor_Avg | Average vacancy rate of 3 nearest neighbor tracts |
| pct_Renter_Occp_HU_ACS___Neighbor_Avg | Average renter rate of 3 nearest neighbor tracts |
| Rate_Independent | Prior-year overdose rate (per 100,000) |
| Cluster_1 | GBTM trajectory cluster 1 indicator |
| Cluster_2 | GBTM trajectory cluster 2 indicator |
| Cluster_3 | GBTM trajectory cluster 3 indicator |
Hyperparameters
| Parameter | Value |
|---|---|
| n_estimators | 500 |
| max_depth | 3 |
| learning_rate | 0.01 |
| subsample | 1.0 |
| colsample_bytree | 1.0 |
| objective | reg:squarederror |
Validation
- Temporal: Out-of-time forecast (trained on โค2024 data, predicting 2025 TTM rates)
- Cross-validation: 5-fold CV โ every tract predicted by a model never trained on it
- Geographic: Cross-regional transfer validated on Los Angeles County, CA
Training Data
- Region: King County, Washington (463 census tracts)
- Target: Overdose death rate per 100,000 (2025 trailing twelve months)
- Census data: ACS 5-year estimates (2019โ2023)
Usage
import xgboost as xgb
import pandas as pd
# Load model
model = xgb.Booster()
model.load_model("xgboost_model.json")
# Prepare features (must match order in features.json)
dtest = xgb.DMatrix(your_features_df)
predictions = model.predict(dtest)
Files
| File | Description |
|---|---|
xgboost_model.json |
Trained XGBoost model (native JSON format) |
xgboost_model.pkl |
Trained XGBoost model (pickle format) |
features.json |
Feature names and target variable |
hyperparameters.json |
Tuned hyperparameters |
training_data.csv |
Full training dataset (463 tracts) |
License
MIT
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support