bootstrap with mh or am is accepted at load, then crashes with a TypeError when the first replicate starts, after the whole main fit has run

Đang mở Phù hợp với người mới
#935 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/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

Hướng nghiên cứu

Bắt đầu với việc xử lý bootstrap tại pybnf/pybnf.py:521 và các phương thức reset sampler trong basic_mcmc.py:101 và adaptive_mcmc.py:165. Theo dõi cách base.py:379 mở samples_file trong start_run, sau đó kiểm tra việc tải cấu hình để tìm một đường dẫn validation. Hoàn tất khi bootstrap sampler không được hỗ trợ bị từ chối trước khi fit chính chạy, bao gồm mh, am và pt, với coverage cho cấu hình đã được báo cáo.

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

Mô tả

bug

The configuration accepts bootstrap = N with job_type = mh or job_type = am. The main fit then runs to the end and writes its results. When the first bootstrap replicate starts, the run stops with Sorry, an unknown error occurred: TypeError: expected str, bytes or os.PathLike object, not NoneType. No replicate is fitted, and the error appears only after the whole main fit has run.

pt shares mh's code and should crash the same way; I did not run it. #862 covers dream and p_dream, where bootstrap runs but each replicate's result is wrong.

Example

boot.conf needs no model or data file:

edition = 2
objective = expression
expression = 0.5*((x - 1)/0.5)^2 + 0.5*((y - 3)/0.5)^2
job_type = mh
uniform_var = x -5 5
uniform_var = y -5 10
max_iterations = 100
burn_in = 50
sample_every = 1
population_size = 2
random_seed = 1
bootstrap = 2
output_dir = out

Run pybnf -c boot.conf -o. It prints Fitting complete, then Beginning bootstrap run 0, then the TypeError, and exits with code 1. job_type = am (with adaptive = 20 added) does the same.

Where in the code

  • pybnf/pybnf.py:521: alg.reset(bootstrap=...) runs before each replicate.
  • pybnf/algorithms/samplers/basic_mcmc.py:101 (mh, pt) and pybnf/algorithms/samplers/adaptive_mcmc.py:165 (am): reset() sets self.samples_file = None.
  • pybnf/algorithms/samplers/base.py:379: the replicate's start_run then opens samples_file to write its header, and gets None.

Unless bootstrapping a sampler is meant to be supported, the simplest fix is to refuse bootstrap for every sampler job_type when the configuration loads. That would also cover #862.

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

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.