With job_type = ms, an ave_norm_sos (column-mean sigma) objective divides each segment by that segment's own data mean, so the segmented stages fit a differently weighted objective from the one the user asked for
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with MultipleShootingProblem._build_objective in pybnf/shooting/problem.py and follow experiment.segment_exp_data through ave_norm_sos in pybnf/objective.py and column_mean in pybnf/noise/source.py. Read _require_series_are_cuttable in pybnf/algorithms/optimizers/multiple_shooting.py and docs/gradient_fitting.rst. Done means segmented scoring matches whole-series scoring, or these settings are clearly rejected, with regression coverage.
索引モデルが issue の本文から書いたものです。
説明
A multiple-shooting fit (job_type = ms) with objective = ave_norm_sos, or noise_model = gaussian, sigma = column_mean, should divide every residual by the mean of the whole data column. Instead, each segment of the time course is divided by the mean of its own rows. Late segments of a decaying curve have small means, so they get a much larger weight, and the segmented stages of the ladder converge to a different optimum. For one decay experiment the correct fit is k = 0.2900. The 4-segment stage drives k to 0.2542, which makes the real objective 47% worse (0.0893 to 0.1311), and the 2-segment stage takes it to 0.2597. The final unsegmented stage then brings k back to 0.28995, so the reported fit is close to right here. But the segmented stages are how ms chooses a basin, and here they steer away from the answer. The docs say ms refuses "any scored quantity that is a function of a whole series", and it does refuse normalization for this reason, but it accepts a column mean without a message.
Example
decay.bngl:
begin model
begin parameters
k 0.3
A0 100
end parameters
begin molecule types
A()
end molecule types
begin seed species
A() A0
end seed species
begin observables
Molecules Atot A()
end observables
begin reaction rules
A() -> 0 k
end reaction rules
end model
tc.exp (70·e^(−0.5t) + 30·e^(−0.1t), which a single exponential cannot fit exactly, so the weighting matters):
# time Atot
0 100
1 69.6023
2 50.3135
3 37.8437
4 29.5831
5 23.9419
6 19.9494
7 17.0114
8 14.762
9 12.9747
10 11.508
ms.conf:
edition = 2
model: decay.bngl
bngl_backend = bngsim
job_type = ms
objective = ave_norm_sos
experiment: tc, data: tc.exp
uniform_var = k 0.01 3
start_point = k 0.8
population_size = 1
max_iterations = 30
output_dir = out_ms
pybnf -c ms.conf prints stage trace: m=4: 0.0892849 m=2: 0.114791 m=1: 0.0773959. In Results/sorted_params_final.txt, listed in run order, the m = 4 stage's iterates move k from 0.2723 (objective 0.0893) to 0.25415 (0.1311). The m = 2 stage ends at k = 0.25966 (0.1148). The single m = 1 iterate is k = 0.28995 (0.0773959).
The correct numbers come from scipy on the closed form 100·e^(−kt), with PyBNF's factor of 1/2:
| objective | minimiser k | whole-series objective there |
|---|---|---|
| each residual divided by the whole column's mean (what was asked for) | 0.29001 | 0.0773958 |
| each of 2 segments divided by its own mean | 0.25966 | 0.1148 |
| each of 4 segments divided by its own mean | 0.25415 | 0.1311 |
The m = 4 and m = 2 stages land exactly on the minimisers of the per-segment-mean objectives. job_type = gntr with the same conf reaches k = 0.290010 (0.0773958).
The same comparison at a single point: at k = 0.3, with every continuity defect zero (so the segments join into the ordinary trajectory), the m = 2 stage scores 0.278768 and the m = 4 stage 0.385826. The single-shoot score is 0.0807138, and numpy gives the same three numbers. Under objective = sos the three agree to seven digits (100.1575), and ms with objective = sos ends at k = 0.290010, the same minimiser, because sos has no divisor. noise_model = gaussian, sigma = column_mean in place of objective = ave_norm_sos gives the same numbers as ave_norm_sos.
Why
MultipleShootingProblem._build_objective (pybnf/shooting/problem.py:409-437) presents each segment to the objective and to the gradient assembly as its own experiment, with experiment.segment_exp_data(segment) (the segment's rows only, problem.py:181-190) as its data (problem.py:426-428). ave_norm_sos computes its divisor from the data it is handed (pybnf/objective.py:2606), and so does the column_mean sigma source (pybnf/noise/source.py:649), so each segment gets its own mean. _require_series_are_cuttable (pybnf/algorithms/optimizers/multiple_shooting.py:627-670) refuses the other quantities computed over a whole series (normalization, an analytic scale, cumulative columns, constraints) but not a column mean. docs/gradient_fitting.rst:219-223 describes that list as refusing "any scored quantity that is a function of a whole series". Reported scores are not affected: certify (problem.py:554-580) re-scores each whole series, which is why the stage trace and sorted_params_final.txt show genuine single-shoot values.
Possible fix
A column mean depends only on the data, so it can be computed once per experiment from the whole series and used for every segment. The segmented objective at a continuous trajectory would then equal the ordinary one, as it already does for sos. Failing that, refuse ave_norm_sos and any sigma = column_mean in _require_series_are_cuttable, with a test either way.
Related: #913 (the final m = 1 stage stops at a loose tolerance, which limits how much of this the last stage can undo)
Found while fixing the PEtab issues #892–#908 (2026-09-25); reproduced on main at 5ecb1f69.
- 主要言語
- Python
- スター
- 25
- フォーク
- 25
- 平均マージ
- 4時間 5分
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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時間 初心者へのやさしさ 80/100
UKGovernmentBEIS/inspect_ai#6733 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ProyectoRespira/respira-webapp#334 ·
メンテナーはふだん 1 日以内に返信
-
bug security-alert
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
spectrayan/carefold#391 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Jakeschincariol/instagram-agent-skill#83 ·
メンテナーはふだん 10 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 64/100