Scoring turns every exception into a failed evaluation (#388's catch-all), so a configuration error, a data error or a bug in a postprocess script ends a fit with exit 0 and a random draw as its best fit
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with Job.run_simulation in pybnf/algorithms/core.py (around lines 390-414) and score_result in pybnf/algorithms/base.py (around lines 936-953), where the catch-all turns exceptions into FailedSimulation or inf. Reproduce with the parabola demo and a postprocess script containing a typo, and confirm that the run currently exits 0. Done means that PybnfError, AttributeError, TypeError, KeyError, NameError and postprocess-script exceptions end the run with a non-zero exit, both scoring paths behave the same, and tests cover an error that fails every evaluation.
由索引模型根据 Issue 内容生成。
描述
Scoring a parameter set catches every exception and turns it into a failed evaluation, on both scoring paths:
- Workers:
Job.run_simulation(pybnf/algorithms/core.py:390-414). An exception while normalizing or scoring becomes aFailedSimulation. An exception in thepostprocessscript becomesres.score = inf. - Master (
local_objective_eval = 1):score_result(pybnf/algorithms/base.py:936-953). Both cases becomeres.score = inf.
The comments cite #388. That issue was a crash ('tuple' object has no attribute 'score') when an evaluation failed. The catch-all that fixed it does not tell a simulation that failed at one parameter set from an error that will fail at every parameter set:
- a configuration or data error (
PybnfError); - a bug in PyBNF (
AttributeError,TypeError,KeyError); - a bug in the user's postprocessing script.
Each of those is penalized one parameter set at a time. The run then ends in one of two ways. It may stop after 100 failures with "Your simulations are failing to run", which points at the simulator, although no simulation failed. Or, under that count, it prints "Fitting complete" and exits 0, and sorted_params_final.txt lists random draws, each with objective inf, the first one as the best fit.
AGENTS.md rules this out: "A configuration or data error is not a simulation failure. ... Let it end the run. Only a genuine simulation failure, such as an integrator that cannot proceed, is scored as a failed simulation." Known instances that reach this path:
- #961: a noise formula naming a fixed model parameter raises a
PybnfErroron every evaluation. - #990 item 3:
normalization = scaleunderneg_binraisedAttributeErroron every evaluation. #994 refuses that at load, but the catch-all stays. - Any exception from a
postprocessscript (reproduction below).
Failure scenario
The demo parabola fit with a postprocess script containing a typo (simdata.dta for simdata.data):
- All 8 evaluations raise
AttributeError: 'Data' object has no attribute 'dta'. - The console prints the traceback and "User-defined post-processing script failed" 8 times, then "Stop criterion satisfied with objective function value of inf" and "Fitting complete".
- The exit code is 0, and
out/Results/sorted_params_final.txtlists four random draws, each with objectiveinf.
Expected: the run stops at the first evaluation with the script's error and a non-zero exit code.
Reproduction
PyBNF main (f5ff92bf), from a folder with examples/demo/parabola.bngl and examples/demo/par1.exp copied in.
pp.py:
def postprocess(simdata):
simdata.dta[:, 1] *= 1.0 # typo: Data has .data, not .dta
return simdata
job.conf:
output_dir = out
model = parabola.bngl : par1.exp
fit_type = de
objfunc = chi_sq
uniform_var = v1__FREE 0 10
uniform_var = v2__FREE 0 10
uniform_var = v3__FREE 0 10
population_size = 4
max_iterations = 2
postprocess = pp.py par1
verbosity = 1
pybnf -c job.conf -o; echo exit=$?:
8 User-defined post-processing script failed
8 AttributeError: 'Data' object has no attribute 'dta'. Did you mean: 'data'?
1 Stop criterion satisfied with objective function value of inf
1 Fitting complete
exit=0
(These are the console lines, counted with sort | uniq -c.)
Possible fix
- Let anything that is not a recognized per-parameter-set numerical failure propagate and end the run: a
PybnfError, anAttributeError/TypeError/KeyError/NameError, and any exception from apostprocessscript. - Keep the penalty only for the failures that really depend on the parameter set. NaN and Inf predictions already have their own path (
unusable_score), and a simulator failure is already aFailedSimulationbefore scoring starts. - Make both scoring paths behave the same, and test each with an error that fails every evaluation.
- 主要语言
- Python
- 星标
- 25
- 派生
- 25
- 平均合并
- 4 小时 5 分钟
- 30 天内合并 PR
- 10
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
lanl/PyBNF 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug minor
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug tech debt
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug minor
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
bug silent-incorrectness
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
jenkinsci/user-guide-ai-chatbot-plugin#132 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
gh-sync ship audits cards before writing station done, so every ship reports false STATUS findings未关闭harness
难度 2/5 1-3 小时 新手友好度 72/100
mruangutai/harness#2455 ·
维护者通常 1 天内回复
-
stripthink leaves thinking text in place when the chat template opens the think tag in the prompt可能已有人在做 @MaiAditya 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复
-
xcorr sizes its bin array from the largest observed m/z, so one out-of-range peak kills the run可能已有人在做 @BioGeek 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
instadeepai/winnow#312 ·