RFC: tracing variables within `JointDistribution`s
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu bằng cách đọc hành vi hiện có của JointDistribution.Root và các phương thức liên quan đến CDF/CMF/PDF/PMF được mô tả trong issue. Xác định ngữ nghĩa của Trace xoay quanh quy trình sinh tiến, sau đó xác minh rằng các giá trị được trace xuất hiện trong model.sample(), trong khi log_prob có thể bỏ qua chúng và chấp nhận các biến còn lại mà không tính toán lại biểu thức.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
Sometimes it would be useful to be able to trace intermediate values computed as part of a JointDistribution* model. The current solution to this is to make use of tfd.Deterministic. As an example, supposing we would like to trace the mean of a simple linear regression on a single feature, a user might write:
@tfd.JointDistributionCoroutine
def model():
intercept = yield tfd.Normal(loc=0.0, scale=1.0, name="intercept")
slope = yield tfd.Normal(loc=0.0, scale=1.0, name="slope")
mean = tfd.Deterministic(intercept + slope * feature, name="mean")
yield tfd.Normal(loc=mean, scale=1.0, name="response")
A call to model.sample() will return a named tuple including the value of mean, conditional on alpha and beta (and feature). However, if we wish to compute the log probability density of the model given response, intercept, and slope, we also have to pass into model.log_prob a value of mean. Here, mean must be consistent with intercept and slope, which requires the user to duplicate the expression for mean outside the model object. e.g.
intercept = 0.1
slope = 0.2
feature = 0.5
response = 0.21
# Since `mean` is deterministic, we should not have to re-compute it outside of `model`
mean = intercept + slope * feature
lp = model.log_prob(intercept=intercept, slope=slope, mean=mean, response=response)
This seems wasteful in terms of keystrokes, but also error-prone if model changes.
Suggested solution
A potential solution would be to include a sub-class similar to JointDistribution.Root called JointDistribution.Trace which would flag an expression for tracing in the forward generating process (i.e. model.sample()), but exclude the associated variable from the CDF/CMF and PDF/PMF-related methods. Thus we could write:
@tfd.JointDistributionCoroutine
def model():
intercept = yield tfd.Normal(loc=0.0, scale=1.0, name="intercept")
slope = yield tfd.Normal(loc=0.0, scale=1.0, name="slope")
mean =Trace(intercept + slope * feature, name="mean")
yield tfd.Normal(loc=mean, scale=1.0, name="response")
draw = model.sample(seed=[0,0])
# `mean` is simply ignored
model.log_prob(draw)
# `mean` does not have to be supplied
model.log_prob(intercept=draw.intercept, slope=draw.slope, response=draw.response)
Does this seem like a feasible addition? (I may have some resource to devote to it)
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 4.4k
- Fork
- 1.1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tensorflow/probability
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KLCó thể đã có người làm @Andreas-Hum đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tensorflow/probability#2036 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
tensorflow/probability#2034 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
tensorflow/probability#2021 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
tensorflow/probability#2015 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
tensorflow/probability#2013 ·
Tất cả issue của tensorflow/probability
Issue tương tự
-
training
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tinaudio/synth-setter#3758 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bot-triaged module: correctness (silent) module: data module: error checking triage review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vllm-project/vllm-ascend#21392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày