Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: tensorflow
|
| 3 |
+
tags:
|
| 4 |
+
- time-series-forecasting
|
| 5 |
+
- terrorism-forecasting
|
| 6 |
+
- lstm
|
| 7 |
+
- bidirectional
|
| 8 |
+
- global-terrorism-database
|
| 9 |
+
- security-analytics
|
| 10 |
+
datasets:
|
| 11 |
+
- gtd
|
| 12 |
+
metrics:
|
| 13 |
+
- rmse
|
| 14 |
+
- mae
|
| 15 |
+
- r2
|
| 16 |
+
license: mit
|
| 17 |
+
language:
|
| 18 |
+
- en
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# BiLSTM for Terrorism Event Forecasting
|
| 22 |
+
|
| 23 |
+
Bidirectional LSTM model for weekly terrorism event forecasting using 46 years of Global Terrorism Database (GTD) data.
|
| 24 |
+
|
| 25 |
+
**Paper**: [Predicting the Unpredictable: Bidirectional LSTM Networks for Terrorism Event Forecasting](https://arxiv.org/abs/2510.15136)
|
| 26 |
+
|
| 27 |
+
## Model Performance
|
| 28 |
+
|
| 29 |
+
| Model | RMSE ↓ | MAE | R² | Improvement |
|
| 30 |
+
|-------|--------|-----|-----|-------------|
|
| 31 |
+
| **BiLSTM (this model)** | **6.38** | **3.82** | **0.556** | **Baseline** |
|
| 32 |
+
| LSTM+Attention | 9.19 | 5.37 | 0.264 | -30.6% |
|
| 33 |
+
| Linear Regression | 9.89 | 5.85 | 0.176 | -35.5% |
|
| 34 |
+
| SARIMA | 11.52 | 6.78 | -0.090 | -44.6% |
|
| 35 |
+
|
| 36 |
+
**Key Achievement**: 37% improvement over best classical baseline (Linear Regression)
|
| 37 |
+
|
| 38 |
+
## Model Architecture
|
| 39 |
+
|
| 40 |
+
- **Type**: Bidirectional LSTM (2 layers)
|
| 41 |
+
- **Input Shape**: (30 weeks, 13 features)
|
| 42 |
+
- **Output**: Single value (next week's attack count)
|
| 43 |
+
- **Parameters**: ~36,673
|
| 44 |
+
- **Framework**: TensorFlow 2.13.0
|
| 45 |
+
|
| 46 |
+
### Architecture Details:
|
| 47 |
+
|
| 48 |
+
Input(30, 13)
|
| 49 |
+
↓
|
| 50 |
+
Bidirectional LSTM(64) + Dropout(0.2)
|
| 51 |
+
↓
|
| 52 |
+
Bidirectional LSTM(32) + Dropout(0.2)
|
| 53 |
+
↓
|
| 54 |
+
Dense(32, ReLU) + Dropout(0.2)
|
| 55 |
+
↓
|
| 56 |
+
Dense(1, Linear)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
## Training Data
|
| 60 |
+
|
| 61 |
+
- **Dataset**: Global Terrorism Database (START consortium)
|
| 62 |
+
- **Time Period**: 1970-2016 (46 years)
|
| 63 |
+
- **Resolution**: Weekly aggregation (2,400 weeks)
|
| 64 |
+
- **Train/Val/Test**: 70%/15%/15% (chronological split)
|
| 65 |
+
|
| 66 |
+
### Features (13 total):
|
| 67 |
+
|
| 68 |
+
1. **Lag Features (1)**: 52-week lag
|
| 69 |
+
2. **Rolling Statistics (4)**: 4-week & 12-week mean/std
|
| 70 |
+
3. **Temporal Encoding (4)**: Year, week, month, quarter
|
| 71 |
+
4. **Casualty Features (3)**: Killed, wounded, total
|
| 72 |
+
5. **Geographic (1)**: Region encoding
|
| 73 |
+
|
| 74 |
+
## Usage
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
import tensorflow as tf
|
| 78 |
+
from huggingface_hub import hf_hub_download
|
| 79 |
+
|
| 80 |
+
# Download model
|
| 81 |
+
model_path = hf_hub_download(
|
| 82 |
+
repo_id="Davidavid4/bilstm-terrorism-forecasting-gtd",
|
| 83 |
+
filename="bidirectional_lstm_best.h5"
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# Load model
|
| 87 |
+
model = tf.keras.models.load_model(model_path)
|
| 88 |
+
|
| 89 |
+
# Prepare input: shape (batch_size, 30, 13)
|
| 90 |
+
# - 30 weeks of historical data
|
| 91 |
+
# - 13 features per week
|
| 92 |
+
|
| 93 |
+
# Make predictions
|
| 94 |
+
predictions = model.predict(X_test)
|