PEtab import_job writes sampler confs that cannot record a draw: max_iterations = 100 with the default burn_in of 10000, and pt with no beta_range

未关闭 适合新手
#1,074 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
testing

调研方向

阅读pybnf/petab/import_.py中_DEFAULT_SETTINGS附近的内容,以及第2077行附近写入的设置。使用提供的fixture复现问题,并用check_fresh_run检查每个生成的sampler配置。完成标准是sampler配置包含sampling window,且pt配置包含beta_range,并添加一个回归测试,覆盖导入器写入的每个sampler配置。

由索引模型根据 Issue 内容生成。

描述

bug

pybnf.petab.import_.import_job writes the same run settings for every job type: population_size = 50, max_iterations = 100 and verbosity = 0 (_DEFAULT_SETTINGS, pybnf/petab/import_.py:219, written at :2077). For a sampler, burn_in is left at its default of 10000, so the generated sampler confs cannot record a draw:

  • Since #1066, dream, p_dream, am, mh and pt are refused at start with "max_iterations (100) must be greater than burn_in (10000), otherwise no samples will be collected."
  • Before #1066 they ran to an empty samples.txt and reported "Fitting complete" (#921).
  • The pt conf also gets no beta_range, so loading it warns that its replica exchanges will accomplish nothing.
  • hmc is accepted (it does not read max_iterations).

Found while reviewing #1066. Reproduced on main at cbb8159c.

Reproduction
import os, re
from pathlib import Path
from pybnf.petab.import_ import import_job
from pybnf import parse, config, printing

out = import_job(Path('tests/petab_fixtures/fixedsigma_v2/problem.yaml'), Path('/tmp/imp'), job_type='all')
os.chdir(out)
for c in sorted(out.glob('imported_*.conf')):
    try:
        conf = config.Configuration(parse.ploop(c.read_text().splitlines(keepends=True)))
        conf.check_fresh_run()
        print(c.name, 'accepted')
    except printing.PybnfError as e:
        print(c.name, 'refused:', e.message.splitlines()[0])

imported_am.conf, imported_dream.conf, imported_mh.conf, imported_p_dream.conf and imported_pt.conf are refused; imported_hmc.conf is accepted. The same happens with job_type='dream' (or any one sampler) in place of 'all'.

What should happen

For a sampler job type, the importer should write a run that records draws:

  • a burn_in below max_iterations, with a max_iterations long enough to leave a sampling window;
  • for pt, a beta_range.

A test should put every sampler conf the importer writes through check_fresh_run, as the reproduction does.

主要语言
Python
星标
26
派生
25
平均合并
4 小时 25 分钟
30 天内合并 PR
9

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

lanl/PyBNF 的其他 Issue

查看 lanl/PyBNF 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。