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

Clarify that sampling statements vs. target += may not always preserve sampling behavior

オープン
#588 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
tex
領域
documentation

調査の方向性

Stan リファレンスマニュアルの Section 7.4 から始め、issue で説明されている 2 つのコード例を比較してください。リンクされている Discourse の議論を読み、parameter-dependent conditionals に関する注意点を理解してください。サンプリング文と target の加算がサンプリングの挙動を維持しない場合をドキュメントが正確に説明できていれば完了です。

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

説明

Section 7.4 of the Stan reference manual says that using the sampling statement y ~ normal(mu, sigma) and incrementing the target probability directly with target += normal_lpdf(y | mu,sigma) will “both lead to the same sampling behavior” but the sampling statement drops constant terms from the log probability function when adding to the target.

But I believe that it is not necessarily true that you get the same sampling behavior if the sampling statement's execution is conditional on parameter values. E.g. consider the snippet

if(b) {
  y ~ normal(mu, sigma)
}
else {
  target += normal_lpdf(y | mu,sigma)
}

if b depends upon parameter values, then this does not give the same sampling behavior as

target += normal_lpdf(y | mu,sigma)

because in the first snippet we drop the extra additive constant terms only on the subsets of parameter values which cause b to evaluate to true.

Of course, if b depends upon parameter values, there are likely other practical issues with inference for such a model. Nevertheless, it might be good to add a caveat or re-word this statement in the documentation.

(See also discussion here: https://discourse.mc-stan.org/t/target-vs-sampling-does-dropping-constants-preserve-sampling-behavior/29118/)

主要言語
TeX
スター
43
フォーク
133
平均マージ
8時間 2分
マージ済み PR(30日)
3

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

stan-dev/docs のほかの issue

stan-dev/docs の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

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

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