Files
iAOP/templates/ti-cl4/quality-forecast/README.md
T
bot_dev1 c6dc7d2344 feat(#68): [Ti-1] 氯化车间质量预测特征工程(基于点位字典)
新增 templates/ti-cl4/quality-forecast/features.py:
- PointDict:解析 point_dict CSV(9 列,对齐 core/edge-gateway),检索/存在性校验
- FeatureSpec:声明式特征(source/transform/window/meaning),换行业只改清单
- FeatureExtractor:按清单从时序样本抽取特征矩阵,缺失值 NaN 占位
- 9 算子:raw/mean/std/min/max/range/diff/slope/ratio
- 零依赖 YAML 子集加载(与 recipe-optim/data-bus 同款)
- config/features.template.yaml:7 个默认特征(炉温/配比/CO波动/炉层/TiCl₄纯度)
- 22 用例全通过;纯标准库零运行时依赖。
2026-08-05 05:14:39 +08:00

38 lines
1.9 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.
# Ti-1 氯化车间质量预测(quality-forecast)
> 父 Issue:#10「[Template-Ti 一期] ① 质量预测 + ③ 炉层杂质预警」
> 子任务:#68 特征工程 / #69 模型训练与评估 / #73 模型部署到内核并接入驾驶舱
基于 `templates/ti-cl4/point-dict/point_dict.default.csv` 默认点位集(CLF-01 沸腾氯化炉 /
RF-01 精制还原 / E-01 能源 / ST-01 蒸汽 / CW-01 循环水),交付「DCS 点表 → 可训练特征
矩阵 → 质量预测 → 部署接入」全链路,对齐 PRD §5.3 ①「质量预测」。
## 设计要点
- **模板化**:特征清单(`config/features.template.yaml`)外置,换行业/换模板只改特征
清单 + 点位字典,特征工程代码零改动(PRD §5.3「换行业只改 Recipe」)。
- **纯标准库零运行时依赖**:CSV/YAML 子集/统计全部自实现(不依赖 numpy/pandas/pyyaml),
便于离线/隔离网部署,与 `recipe-optim` / `impurity-forecast` 内核模块一致。
- **可解释前置**:每个 `FeatureSpec` 带 `meaning`(工艺含义),供 #69 模型可解释性引用。
## 模块
| 文件 | 说明 | Issue |
| --- | --- | --- |
| `features.py` | 点位字典 `PointDict` + 特征规格 `FeatureSpec` + 抽取器 `FeatureExtractor` | #68 |
| `model.py` | 质量预测模型训练与评估(岭回归 + R²) | #69 |
| `serve.py` | 模型部署到内核并接入驾驶舱(预测服务) | #73 |
| `config/features.template.yaml` | 默认特征清单(7 个特征,对齐默认点位集) | #68 |
## 算子
`raw / mean / std / min / max / range / diff / slope / ratio`(`ratio` 需 `denominator`)。
缺失点位统一用 `NaN` 占位,便于上层判空屏蔽(`FeatureMatrix.drop_nan_rows()`)。
## 运行
```bash
# 单测(嵌入式 Python 3.12 即可,无第三方依赖)
python -m unittest discover -s templates/ti-cl4/quality-forecast/tests -p "test_*.py" -v
```