Skip to content

Commit 1c809a7

Browse files
committed
improve numerical stability of inverse sigmoid
1 parent 8210610 commit 1c809a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bayesflow/utils/numpy_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def inverse_sigmoid(x: np.ndarray) -> np.ndarray:
66
"""Inverse of the sigmoid function."""
7-
return np.log(x / (1 - x))
7+
return np.log(x) - np.log1p(-x)
88

99

1010
def inverse_shifted_softplus(

0 commit comments

Comments
 (0)