Data at times the model writes no output for are refused or fitted depending on where the clock starts, the fit type, and how t_end is written
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start with objective.matching_row and Configuration._refuse_data_without_rows, then compare the constraint matching in constraint._crossing_indices and output grid handling in bngsim_model.grid.kept_output_rows. Run the named strict xfail tests in tests/test_ms_review14_segments.py and tests/test_ms_review15_segments.py to reproduce the time-base, fit-type, constraint, and t_end cases. Done means the tests pass and data and constraints are handled consistently across time bases, fit types, and equivalent t_end expressions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What you do. Fit data at times the model does not write output at. For example, a model whose action writes a row every 1.0 (n_steps too small) and data every 0.25.
What you see. Whether that is an error depends on where the clock starts, on the fit type, and on how t_end is spelled. It should depend on none of them.
- Where the clock starts. With
t_start=>100the configuration is refused as it loads: "the data for "tc" has t = 100.25, ... where the action writes no row". Witht_start=>100000and nothing else changed, it loads and fits.gntranddescore each datum against the nearest whole-number row and report k = 1.0686. The data's own optimum is k = 1.0063 (scipy on the closed form). - The fit type. In that same job,
job_type = msreports k = 1.0063. It simulates at each datum's own time and never reads the action's rows. So two fit types report two best fits for one configuration, with no message from either. - How
t_endis spelled. Witht_start=>0, t_end=>2every fit type refuses the job at load. Witht_end=>1+1, the output times are not worked out at load. Thengntrstops at its first evaluation ("time=0.25 ... is not in the simulation output"), andmsfits it. - Constraints. A constraint
at time = T, with T three quarters of the way between two rows, reads the earlier row (PyBNF's documented convention) when the time base is 0, 100 or 1e4. From 1e5 on, it reads the later row. On a trajectory whose value is ten times its row number, the penalty ofA < 0 at time = Tis 20 at the lower bases and 30 at the higher ones.
Why. A datum is matched to a simulated row when the two times agree to within 1e-5 of the time, numpy's default relative tolerance. That is deliberate: a time written to six significant digits, such as 10.1667 for 10 h 10 min, has to match its row at 10.16666.... But the tolerance grows with the time. Far enough from t = 0 it is wider than the step between rows, so a datum between two rows is matched to one of them instead of being refused. The constraints' own time match does the same.
What should happen. Whether a datum or a constraint time has a row should not depend on the time base, the fit type, or how the action's arguments are written. A tolerance alone cannot decide it. An attempt during review of fix/ms-batch required a row to be within a thousandth of the row spacing, as well as within the relative tolerance. That refused valid data: a per-minute 24 h course with times written to six digits lost 56 of its 145 data. It was reverted before merge. Two other directions:
- Have the simulator write output at each data time, as
msalready does. Then there is nothing to match. - Refuse at load when the relative tolerance at a datum's time is wider than the step between rows, unless the datum is on a row.
The second is narrower, but on its own it refuses jobs on a late time base that load today.
Where.
objective.matching_row(the objective and the load-time checkConfiguration._refuse_data_without_rows).constraint._crossing_indices.bngsim_model.grid.kept_output_rows, which gives up when an action argument is an expression such as1+1.msscores segments at the data's own times (pybnf/shooting/).
Reproduction. These tests are in the branch as strict xfails:
tests/test_ms_review14_segments.py:test_a_datum_between_two_simulated_rows_is_refused_at_any_time_base,test_data_finer_than_the_models_output_grid_is_refused_on_a_late_time_baseandtest_ms_and_gntr_report_one_fit_for_one_configuration_on_a_late_time_base.tests/test_ms_review15_segments.py: the constraint andt_end=>1+1cases.
The model is A() -> 0 at k_deg from A = 1, with simulate({method=>"ode",t_start=>100000,t_end=>100002,n_steps=>2,suffix=>"tc"}), and data every 0.25 from 100000 to 100002. The job:
edition = 2
bngl_backend = bngsim
model = m.bngl : tc.exp
objective = sos
uniform_var = k_deg 0.1 10
job_type = gntr
Found during review of the multiple-shooting batch (fix/ms-batch). The behaviour is the same on main, except that main also matched a datum to the first row within the tolerance rather than the nearest one. fix/ms-batch fixes that.
- Lingua principale
- Python
- Stelle
- 26
- Fork
- 25
- Merge medio
- 4h 25m
- PR unite (30g)
- 9
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 78/100
-
min_objective stops a sampler run early and reports "Fitting complete": samplers should refuse itApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
bug minor
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
-
bug minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Issue simili
-
docs(contributing): the two things that silently block a PRForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaavailable documentation good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 95/100
Nixitov/Riptide-Native#944 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
JTHCode/secretguard#24 ·
I maintainer di solito rispondono entro 1 giorno
-
area: middleware documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 ·
I maintainer di solito rispondono entro 1 giorno