Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#588 5 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
tex
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với Section 7.4 của tài liệu tham khảo Stan và so sánh hai ví dụ mã được mô tả trong issue. Đọc cuộc thảo luận Discourse được liên kết để hiểu lưu ý về các điều kiện phụ thuộc vào tham số. Hoàn thành khi tài liệu giải thích chính xác khi nào các câu lệnh lấy mẫu và các phép tăng target không bảo toàn hành vi lấy mẫu.

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

Mô tả

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/)

Ngôn ngữ chính
TeX
Star
43
Fork
133
Merge trung bình
11 giờ 32 phút
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 stan-dev/docs

Tất cả issue của stan-dev/docs

Issue tương tự

Thêm issue về Documentation

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.