Skip to content

Commit 20322a1

Browse files
committed
Remove redundant test_logccdf_helper_numerical_stability
The test_logccdf_numerical_stability test already covers this functionality at the public API level. The helper test was redundant since it tested the same numerical stability property through _logccdf_helper.
1 parent 19b9979 commit 20322a1

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

tests/logprob/test_abstract.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,6 @@ def test_logccdf_helper():
9696
np.testing.assert_almost_equal(x_logccdf.eval(), sp.norm(0, 1).logsf([0, 1]))
9797

9898

99-
def test_logccdf_helper_numerical_stability():
100-
"""Test that logccdf is numerically stable in the far right tail.
101-
102-
This is where log(1 - exp(logcdf)) would lose precision because CDF is very close to 1.
103-
"""
104-
x = pm.Normal.dist(0, 1)
105-
106-
# Test value far in the right tail where CDF is essentially 1
107-
far_tail_value = 10.0
108-
109-
x_logccdf = _logccdf_helper(x, far_tail_value)
110-
result = x_logccdf.eval()
111-
112-
# scipy.stats.norm.logsf uses a numerically stable implementation
113-
expected = sp.norm(0, 1).logsf(far_tail_value)
114-
115-
# The naive computation would give log(1 - 1) = -inf or very wrong values
116-
# The stable implementation should match scipy's logsf closely
117-
np.testing.assert_almost_equal(result, expected, decimal=6)
118-
119-
12099
def test_logcdf_transformed_argument():
121100
with pm.Model() as m:
122101
sigma = pm.HalfFlat("sigma")

0 commit comments

Comments
 (0)