40 lines
1.2 KiB
Markdown
40 lines
1.2 KiB
Markdown
|
|
# Models — SpatialTemporalGCN
|
||
|
|
|
||
|
|
## Architecture
|
||
|
|
|
||
|
|
Spatiotemporal GCN for Wuhan respiratory disease risk prediction:
|
||
|
|
|
||
|
|
- **Temporal**: Transformer encoder (3 layers, 4 heads) over 14-day weather windows
|
||
|
|
- **Spatial**: 2-layer GCN (48→128→64) with elevation/population scaling
|
||
|
|
- **Output**: `[N, 3]` risk probabilities (1-day, 3-day, 7-day horizons)
|
||
|
|
|
||
|
|
## Files
|
||
|
|
|
||
|
|
```
|
||
|
|
models/spatiotemporal_gcn/
|
||
|
|
model.py # SpatialTemporalGCN class + ONNX export
|
||
|
|
sampler.py # Graph sampling utilities
|
||
|
|
best_model.pt # Trained weights (gitignored)
|
||
|
|
```
|
||
|
|
|
||
|
|
## Input Shape
|
||
|
|
|
||
|
|
- Node features: `[N, T=14, 48]` — N nodes, 14 timesteps, 48 weather features
|
||
|
|
- Edge index: `[2, E]` — sparse adjacency from 100m grid graph
|
||
|
|
- Spatial scalars: elevation + population density per node
|
||
|
|
|
||
|
|
## Training
|
||
|
|
|
||
|
|
```bash
|
||
|
|
python scripts/train_model.py # Full pipeline with MLflow tracking
|
||
|
|
```
|
||
|
|
|
||
|
|
Baseline MAE targets: 1-day=0.2314, 3-day=0.5424, 7-day=0.6391
|
||
|
|
|
||
|
|
## Anti-Patterns
|
||
|
|
|
||
|
|
- Don't change model architecture without updating `scripts/train_model.py` and `scripts/inference_*.py`
|
||
|
|
- Don't load `best_model.pt` without matching the exact `SpatialTemporalGCN` constructor args
|
||
|
|
- Don't skip ONNX export validation after architecture changes
|
||
|
|
- Don't train without MLflow logging
|