Files
elderly-heat-warning/README.md
T
Serendipity 07468266b4 feat: 完成模型训练/评估/Web大屏/LaTeX论文框架
- LSTM-Attention模型(983K参数) + XGBoost基线
- Flask API后端(4端点) + ECharts可视化大屏(6面板)
- LaTeX学位论文完整框架(7章+参考文献)
- ERA5下载脚本(CDS逐月并行下载)
- README项目文档

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 21:01:42 +08:00

175 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 银发群体高温多时间尺度预警和服务优化可视化研究
本科毕业设计 — 河南理工大学计算机科学与技术学院
## 概述
本项目针对焦作市和郑州市老年群体,构建了基于 LSTM-Attention 的多时间尺度高温健康风险预警模型,并开发了 ECharts 可视化大屏系统。
### 核心功能
- **多时间尺度预警**:短期(1-3天)、中期(7天)、长期(30天)三级高温健康风险预测
- **深度学习模型**BiLSTM + Multi-Head Attention,三头输出同时预测三个时间尺度
- **基线对比**:XGBoost 三分类器,验证深度学习方法有效性
- **可视化大屏**:6 面板深色科技蓝风格 Web 大屏,含温度趋势、风险预警、人口统计等
- **完整论文**:LaTeX 学位论文,含 7 个章节 + 参考文献 + 附录
### 技术栈
| 层 | 技术 |
|----|------|
| 数据处理 | Python, xarray, pandas, numpy |
| 气象数据 | ERA5-Land (CDS API) |
| 深度学习 | PyTorch 2.12, CUDA 12.6 |
| 传统模型 | XGBoost, scikit-learn |
| Web 后端 | Flask |
| 可视化 | ECharts 5.5 |
| 包管理 | uv |
| 论文 | LaTeX (XeLaTeX + ctexbook) |
## 环境配置
### 系统要求
- Python 3.13
- NVIDIA GPU (推荐,RTX 4060 或以上)
- Windows 11 / Linux
### 安装
```bash
# 创建虚拟环境
uv venv --python "D:\settings\Language\Python\Python 3.13.13\python.exe"
# 安装依赖
uv pip install -e .
```
### CDS API 配置(数据下载必需)
1. 注册 Copernicus CDS 账号:https://cds.climate.copernicus.eu/
2. 获取 API Key
3. 创建 `~/.cdsapirc`
```
url: https://cds.climate.copernicus.eu/api
key: <UID>:<API_KEY>
```
## 运行指南
### 1. 数据获取与预处理
```bash
# 下载 ERA5 气象数据(需要 CDS API 配置)
python -m src.data.download_era5
# 收集死亡率与人口数据
python -m src.data.collect_mortality
# 运行预处理管道
python -m src.data.preprocess
```
### 2. 探索性数据分析
```bash
jupyter notebook notebooks/eda.ipynb
```
### 3. 模型训练
```bash
# 训练 LSTM-Attention 模型
python -m src.models.train
# 模型评估与对比
python -m src.models.evaluate
```
### 4. 启动可视化大屏
```bash
python -m src.web.app
# 浏览器打开 http://localhost:5005
```
### 5. 论文编译
```bash
cd thesis
make
# 或手动: xelatex main && biber main && xelatex main && xelatex main
```
## 项目结构
```
project/
├── data/
│ ├── raw/era5/ # ERA5 原始 NetCDF 文件
│ ├── processed/ # 预处理后 CSV 和 NPZ 序列
│ └── external/ # 死亡率/人口/暴露反应数据
├── src/
│ ├── data/ # 数据获取与预处理
│ │ ├── download_era5.py
│ │ ├── collect_mortality.py
│ │ └── preprocess.py
│ ├── models/ # 模型定义与训练
│ │ ├── lstm_attention.py
│ │ ├── xgboost_baseline.py
│ │ ├── train.py
│ │ └── evaluate.py
│ ├── web/ # Web 可视化
│ │ ├── app.py
│ │ └── static/index.html
│ └── utils/
│ └── config.py # 全局配置
├── notebooks/
│ └── eda.ipynb # 探索性数据分析
├── outputs/
│ ├── models/ # 训练好的模型权重
│ ├── figures/ # 论文和评估图表
│ └── logs/ # 训练日志
├── thesis/ # LaTeX 学位论文
│ ├── main.tex
│ ├── chapters/ # 各章节 tex 文件
│ ├── refs.bib # 参考文献
│ └── Makefile
└── docs/superpowers/ # 设计文档和计划
```
## 模型架构
```
输入 (14天气象序列)
→ Linear 嵌入 (16 → 128)
→ 2层 BiLSTM (128, dropout=0.3)
→ Multi-Head Attention (4 heads)
→ Linear 投影 (256 → 128)
→ 三头输出
├── 短期头 (128→64→4)
├── 中期头 (128→64→4)
└── 长期头 (128→64→4)
```
总参数量:~983K
## 风险等级定义
| 等级 | 条件 | 颜色 |
|------|------|------|
| 低风险 | 体感温度 < 32°C | 绿 |
| 中风险 | 体感温度 32-35°C | 黄 |
| 高风险 | 体感温度 35-38°C 或连续 3 天 >35°C | 橙 |
| 严重风险 | 体感温度 >= 38°C 且连续 3 天 >35°C | 红 |
## 数据来源
| 数据 | 来源 | 时间范围 |
|------|------|----------|
| 气象数据 | ERA5-Land (Copernicus CDS) | 2010-2024 |
| 死亡率 | 中国卫生健康统计年鉴 | 2010-2023 |
| 暴露反应曲线 | Chen et al. (2018) Lancet Planet Health | — |
| 人口数据 | 第七次全国人口普查 (2020) | 2020 |
| 老龄化率 | 河南省统计年鉴 | 2010-2023 |