Chi2, Gamma, Beta and Binomial survival_function lose the upper tail because they fall back to 1 - cdf
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 54/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python, tensorflow
- Lĩnh vực
- backend, machine-learning
Hướng nghiên cứu
Start with the fallback in distribution.py:1495 and compare it with the survival function override added for Poisson in poisson.py:282. Reproduce the reported float64 cases, then inspect the Chi2, Gamma, Beta, and Binomial implementations and their existing tests. Done means their survival functions preserve the reported small upper-tail probabilities with suitable tests for the numerical behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
import tensorflow as tf, tensorflow_probability as tfp
tfd = tfp.distributions
d = lambda v: tf.constant(v, tf.float64)
tfd.Chi2(d(1.80006)).survival_function(d(90.5982)) # 0.0
tf.math.igammac(d(1.80006) / 2, d(90.5982) / 2) # 1.353746583750377e-20
tfd.Chi2(d(20.0)).survival_function(d(100.0)) # 1.2596590437397026e-12
tf.math.igammac(d(10.0), d(50.0)) # 1.2596084591660847e-12
tfd.Gamma(d(10.0), d(0.5)).survival_function(d(100.0)) # 1.2596590437397026e-12
tfd.Binomial(total_count=d(50.0), probs=d(0.01)).survival_function(d(25.0)) # 1.1102230246251565e-16
tfd.Beta(d(50.0), d(200.0)).survival_function(d(0.5)) # 1.1102230246251565e-16
tf.math.betainc(d(200.0), d(50.0), 1 - d(0.5)) # 3.93029180905806e-23
| call | actual | enclosure of the true value | miss |
|---|---|---|---|
Chi2(1.80006).survival_function(90.5982) |
0.0 | 1.3537465837503759e-20 | 9e15 ulp |
Chi2(20).survival_function(100) |
1.2596590437397026e-12 | 1.2596084591660908e-12 | 2.5e11 ulp |
Binomial(50, 0.01).survival_function(25) |
1.1102230246251565e-16 | 9.6362741287734525e-39 | 8.5e37 ulp |
Beta(50, 200).survival_function(0.5) |
1.1102230246251565e-16 | 3.9302918090574181e-23 | 1.9e22 ulp |
The chi-square values are Arb ball-arithmetic enclosures at the exact double inputs, and the binomial and Beta values are exact rationals (integer shapes). None of these classes overrides _survival_function, so each gets the base class's 1 - cdf, and a probability below about 1e-16 becomes 0 or the rounding noise of the subtraction. Above that the relative error is about 1e-16/S: 4e-5 at S = 1.26e-12. The fallback is at distribution.py:1495, unchanged on main. Poisson got this fix in #1311 (poisson.py:282).
igammac matches at these points. Using it takes the chi-square count from 103 to 13 of 758; the 13 left all have df above 5,000 and are a separate large-a error. tf.math.betainc(b, a, 1 - x) agrees to 1.6e-13 here and takes Beta from 64 to 27 of 378. betainc(k+1, n-k, p) takes the binomial from 72 to 2 of 296. StudentT and Normal have their own _survival_function and were clean over their own test points (1,002 and 529). The counts are relative error above 1e-12, on a fixed grid and log-uniform draws.
Version: tensorflow-probability 0.25.0, tensorflow-cpu 2.21.0, float64, CPU, Windows x86-64, Python 3.12. Values are identical on tensorflow-cpu 2.18.0.
Found and drafted with an AI agent (Claude); a second agent re-ran the repro and the numbers independently.
- 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ự
-
[Bug] The blue-green mitigation strategy lists catalog names and views before the source tablesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws-samples/sample-aws-genai-db-modernizer#2097 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Vec<Item> extended comparisonsĐang mởgood first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
servo/rust-smallvec#872 ·
-
api-platform/doctrine-common requires abandoned doctrine/common but doesn't appear to use itĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
api-platform/core#8835 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Python SDK overwrites OVPack backups with HTTP 200 JSON errorsCó thể đã có người làm @stefanielizeth73-art đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
volcengine/OpenViking#7347 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SelectOneHealthyInstance panics when instance weights are fractional (e.g. 0.5)Có thể đã có người làm @Ajax-1 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
nacos-group/nacos-sdk-go#929 ·