hmc requires max_iterations, which it never reads, and the docs' hmc example fails to load without it

未关闭
#1,077 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

Start in pybnf/config.py at Configuration._req_user_params() and trace how required parameters are selected for HMC; compare with the handling of unread beta mentioned in the issue. Read the HMC tests in tests/test_hmc.py and tests/test_wall_time_fit.py, plus the example in docs/analytical_objectives.rst. Done when the docs example loads without max_iterations, setting that key for HMC is rejected with guidance about num_warmup and num_samples, and the example has a loading test.

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

描述

bug documentation

Every fit must set max_iterations: Configuration._req_user_params() returns {'models', 'population_size', 'max_iterations'} (pybnf/config.py:795). hmc never reads it. Its run length is num_warmup and num_samples. So an hmc conf must carry a key that has no effect. The hmc example in docs/analytical_objectives.rst ("Sample a banana posterior with HMC", about line 272) leaves the key out, so it fails to load when copied as shown:

Error: The following configuration keys must be specified:
	max_iterations

The PEtab importer writes max_iterations = 100 into the hmc confs it generates for the same reason (#1074).

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

Reproduction

Load the snippet from the docs as it stands:

edition     = 2
objective   = banana, a = 1, b = 8
job_type    = hmc
uniform_var = x1 -12 12
uniform_var = x2 -12 12
population_size = 4
num_warmup   = 1000
num_samples  = 2000
target_accept = 0.95
What should happen

Don't require max_iterations for hmc. Then, as #860 did for an unread beta, refuse it when it is set, with a message pointing to num_warmup and num_samples, so no one thinks it sets the run length. No shipped conf selects hmc; the tests (tests/test_hmc.py, tests/test_wall_time_fit.py) and the PEtab importer are what set it today. Add a test that loads the docs example as written.

主要语言
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 摘要。