Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#935 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

pybnf/pybnf.py:521 の bootstrap 処理と、basic_mcmc.py:101 および adaptive_mcmc.py:165 の sampler リセットメソッドから始めます。start_run 中に base.py:379 が samples_file を開く流れを追い、その後、検証経路がないか設定の読み込みを確認します。mh、am、pt を含め、サポートされていない sampler の bootstrap がメインの fit の実行前に拒否され、報告された設定を対象とするカバレッジがあることが完了条件です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
25
フォーク
25
平均マージ
10時間 54分
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lanl/PyBNF のほかの issue

lanl/PyBNF の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。