Reproducibility
Code packaging, data management, and reproducibility assurance.
Use This Skill When
- Packaging analysis code for sharing or archiving.
- Documenting computational environments (dependencies, versions).
- Archiving datasets with metadata (FAIR principles).
- Creating reproducible workflow pipelines.
- Preparing supplementary materials for publication.
Workflow
Code reproducibility:
- Create
requirements.txt/environment.ymlwith pinned versions - Write a
README.mdwith setup and execution instructions - Add seed values for random processes
- Verify the pipeline runs from scratch
- Create
Data management:
- Document data provenance and preprocessing steps
- Create data dictionary with variable descriptions
- Apply FAIR principles (Findable, Accessible, Interoperable, Reusable)
- Generate checksums for data integrity
Workflow automation:
- Create Makefile or shell scripts for end-to-end execution
- Document expected outputs and intermediate checkpoints
- Add validation steps between pipeline stages
Archiving:
- Prepare for repository deposit (Zenodo, Figshare, Dryad)
- Generate DOI-ready metadata
- Create a LICENSE file
Deliverables
report.md: reproducibility assessment summary.results/reproducibility-checklist.md: item-by-item evaluation.results/environment-spec.md: environment documentation.results/data-dictionary.md: variable descriptions and metadata.
Quality Gates
- All dependencies are pinned to specific versions.
- Random seeds are set and documented.
- Pipeline runs from a clean environment without manual intervention.
- Data provenance is documented from raw to processed.
- A README explains how to reproduce the analysis.
If any gate fails: identify the specific failing check, fix the issue, and re-validate before proceeding.
Gotchas
pip freezeの出力をそのまま使わないこと。直接依存のみをrequirements.txtに書き、間接依存はpip freeze > requirements-lock.txtで分離する- Jupyter Notebook は再現性が低い(セル実行順序依存)。必ず
.pyスクリプトに変換するか、nbconvert --executeで通しテストすること - ランダムシードは numpy, random, torch 等のライブラリごとに個別に設定が必要
- データサイズが大きい場合(>100MB)はリポジトリに含めず、ダウンロードスクリプトを提供すること
Validation Loop
- 再現性パッケージを生成
- チェック:
- 依存関係がバージョン固定されているか
- ランダムシードが全ライブラリで設定されているか
- クリーン環境からの実行手順が README に記載されているか
- データの出所と加工手順が文書化されているか
- 不合格なら修正
- 可能であればクリーン環境でテスト実行して検証