You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SMCABC: distance_based_decay picks the wrong epsilon — cumsum(distances)/sum(distances) is not a CDF #2117
What happens. With distance_based_decay=True, SMCABC is supposed to set the next acceptance threshold ε to the epsilon_decay-th quantile of the previous population's distances (so epsilon_decay=0.5 ≈ halving, 0.1 ≈ 10th percentile). Instead, _get_next_epsilon() computes
cumsum(d)/sum(d) is the CDF of a distribution whose mass is proportional to the distance value, not the empirical CDF of the samples. Because the largest distances dominate the sum, the >= quantile crossing happens near the end of the array. So ε is biased high, and whenever the distance distribution is heavy-tailed it simply returns the maximum distance — i.e. ε does not tighten at all.
How it differs from expected. Expected: next ε = empirical epsilon_decay quantile of the previous distances. Actual: next ε ≈ 60th–100th percentile regardless of epsilon_decay. MCABC already does the right thing by rank (int(num_simulations * quantile)), which shows the intended semantics.
Impact: with a fixed num_simulations budget, ε decays far too slowly, so you get fewer useful refinement populations and a broader ε-ABC posterior than the epsilon_decay you asked for. It fails silently — no warning, no exception.
I also found a couple of unrelated candidates while reading (e.g. ImportanceSamplingPosterior doesn't invalidate _normalization_constant after set_default_x), but this SMC-ABC one is the clean, self-contained, reproducible defect.
@janfb Fix is simple take the real empirical quantile of the unique sorted distances
Nothing changes for distance_based_decay=False since that path is separate.
I'll add a small test asserting _get_next_epsilon == torch.quantile(distances, q) for a few q, then open a PR.
@BHARATH0153 thanks for the clear report, and for proposing the fix here first. I can confirm it: the cumulative sum of the sorted distances is not their empirical CDF, so with uniform distances epsilon_decay=0.1 picks about the 32nd percentile and 0.5 about the 71st.
Please go ahead with the PR as you describe it. Please also update the docstring of distance_based_decay, so that it says that epsilon_decay is then the quantile of the previous population's distances.
The ImportanceSamplingPosterior normalization after set_default_x is part of PR #2107.
Activity
BHARATH0153 commentedon Oct 29, 2026
@janfb Fix is simple take the real empirical quantile of the unique sorted distances
Nothing changes for distance_based_decay=False since that path is separate.
I'll add a small test asserting _get_next_epsilon == torch.quantile(distances, q) for a few q, then open a PR.
janfb commentedon Oct 29, 2026
@BHARATH0153 thanks for the clear report, and for proposing the fix here first. I can confirm it: the cumulative sum of the sorted distances is not their empirical CDF, so with uniform distances
epsilon_decay=0.1picks about the 32nd percentile and0.5about the 71st.Please go ahead with the PR as you describe it. Please also update the docstring of
distance_based_decay, so that it says thatepsilon_decayis then the quantile of the previous population's distances.The
ImportanceSamplingPosteriornormalization afterset_default_xis part of PR #2107.cheers, Jan
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: use the empirical distance quantile for the SMCABC epsilon
fix: SMCABC epsilon quantile and EnsemblePosterior.map deprecation (s…