Skip to content

Commit e49134a

Browse files
committed
clip posterior contraction between 0 and 1
1 parent a4cbd16 commit e49134a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bayesflow/diagnostics/plots/z_score_contraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def z_score_contraction(
110110
prior_vars = targets.var(axis=0, keepdims=True, ddof=1)
111111

112112
# Compute contraction and z-score
113-
contraction = 1 - (post_vars / prior_vars)
113+
contraction = np.clip(1 - (post_vars / prior_vars), 0, 1)
114114
z_score = (post_means - targets) / post_stds
115115

116116
# Loop and plot

0 commit comments

Comments
 (0)