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

Đang mở
#1,062 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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=>100 the configuration is refused as it loads: "the data for "tc" has t = 100.25, ... where the action writes no row". With t_start=>100000 and nothing else changed, it loads and fits. gntr and de score 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 = ms reports 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_end is spelled. With t_start=>0, t_end=>2 every fit type refuses the job at load. With t_end=>1+1, the output times are not worked out at load. Then gntr stops at its first evaluation ("time=0.25 ... is not in the simulation output"), and ms fits 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 of A < 0 at time = T is 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 ms already 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 check Configuration._refuse_data_without_rows).
  • constraint._crossing_indices.
  • bngsim_model.grid.kept_output_rows, which gives up when an action argument is an expression such as 1+1.
  • ms scores 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_base and test_ms_and_gntr_report_one_fit_for_one_configuration_on_a_late_time_base.
  • tests/test_ms_review15_segments.py: the constraint and t_end=>1+1 cases.

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.

Ngôn ngữ chính
Python
Star
26
Fork
25
Merge trung bình
4 giờ 25 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lanl/PyBNF

Tất cả issue của lanl/PyBNF

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.