rlclean / docs /ARCHITECTURE.md
zhangdebiao's picture
Full project snapshot
61da913 verified
|
Raw History Blame Contribute Delete
1.59 kB

Architecture

分层

  • Domain
    • domain/model.py
    • domain/methods.py
    • domain/consistency.py
    • domain/invariants.py
    • src/rlclean/repair/ (detector/ddpm/bandit)
  • Application
    • src/rlclean/pipeline/pipeline_service.py
    • src/rlclean/pipeline/cleaner.py
  • Infrastructure
    • src/rlclean/utils/executor.py
    • src/rlclean/utils/registry.py
  • Interface
    • src/rlclean/cli/main.py

设计意图

  • Domain 不依赖脚本细节,只定义方法语义、约束与规则。
  • Application 只编排用例,不关心底层命令执行实现。
  • Infrastructure 只处理执行、路径、日志落盘。
  • Interface 只负责输入配置并触发应用服务。

编排模型

  • PipelineService 负责阶段顺序:

    • build_dataset
    • detect
    • filter
    • verify_alignment
    • run_cleaners
    • evaluate
  • 方法策略:

    • DecoupledDetectorStrategy
    • DDPMCleanerStrategy
    • BanditCleanerStrategy

三者通过统一接口接入 orchestrator,可串行或并行。

产物规范

每个 run 按噪声类型独立归档:

runs/<run_name>/<noise_type>/
├── configs/
├── logs/
├── scores/
├── indices/
├── datasets/
├── models/
│   ├── ddpm/
│   └── bandit/
└── eval/

一致性防线

domain/consistency.py + domain/invariants.py 对以下关键条件做强校验:

  • clean/dirty 分区互斥且覆盖评估核心区间
  • 索引不越界
  • pred_mask_s/a/r 长度与全量 transition 对齐

不满足即中断流程,避免错误数据进入清洗阶段。