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
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 25
- Fork
- 25
- Merge medio
- 4h 5m
- PR unite (30g)
- 10
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lanl/PyBNF
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug silent-incorrectness
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
eegprep-lean: set channel types from the Zarr group's channel_typeForse già presa @claude l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sccn/eegprep#668 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade Django to 5.2.18Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
blacklanternsecurity/bbot#3679 ·
I maintainer di solito rispondono entro 2 giorni
-
Link Checker ReportApertaBot Type: Bug Type: Documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno