Add disease history ablation modes

This commit is contained in:
2026-07-29 13:53:15 +08:00
parent 31f129a7dc
commit c622ec50f7
10 changed files with 1178 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
疾病序列 stream + 统一的额外信息 token stream
```
疾病、死亡、checkup 事件仍然保存在事件序列里;性别单独保存在 `basic_info`;其他体检、暴露、生活方式等信息统一整理成 `(type, value, value_kind, time)` token。
疾病、死亡、checkup 事件保存在预处理事件文件中;性别单独保存在 `basic_info`;其他体检、暴露、生活方式等信息统一整理成 `(type, value, value_kind, time)` token。dataset 仅在实验选择了至少一种 extra-info type 时保留 checkup显式传入空列表时模型输入是没有 checkup 的纯疾病历史。
## 数据准备
@@ -267,6 +267,28 @@ python train_all_future.py \
--extra_pool_reduce mean
```
纯疾病历史的 T/O/S 消融仅用于
`TrajMixer + all_future + relative + Weibull + extra_info_types=[]`
```bash
python train_all_future.py \
--model_architecture traj_mixer_v5 \
--time_mode relative \
--dist_mode weibull \
--extra_info_types_file extra_info_types_none.txt \
--disease_history_mode ordered
```
`--disease_history_mode` 的含义:
- `timed`保留疾病事件顺序和真实患病时间T
- `ordered`:保留疾病事件顺序,以 `0, 1, ..., G-1` 的首发日期顺序组替代真实时间同日首发疾病共享一个位置query 位置为 `G`O
- `set`:疾病代码去重并排序,疾病和 query 的模型时间全部为 `0`不保留顺序或患病时间S
查询点、未来疾病、`future_dt`、exposure、Landmark 年龄与 AUC
病例/对照始终使用真实时间。训练配置会记录 `disease_history_mode`
旧配置缺少该字段时按 `timed` 处理。
选择额外信息变量:
```bash
@@ -279,6 +301,7 @@ python train_next_step.py --extra_info_types_file extra_info_types_smoking_alcoh
- `extra_info_types_file`:训练时使用的列表文件名
- `extra_info_types`:解析后的实际 type id 列表,用于评估脚本复现变量选择
- `disease_history_mode`all-future 模型使用的 T/O/S 疾病历史表示
- `extra_pool_reduce`:同一 `other_time` 的 extra-info tokens 池化方式,默认为 `mean`
- `model_target_mode`、`time_mode`、`dist_mode`、`dataset_class`、`collate_fn`、`resolved_loss_name`:用于评估脚本重建模型和输入方式