From bffb5a78b1ebbc88adc2323580dfa6ef2ffcb741 Mon Sep 17 00:00:00 2001 From: Ben Cox Date: Sun, 16 Aug 2026 00:58:31 +0200 Subject: [PATCH] Fix adaptive multi-proposal tuning --- .../mcmc/mcmc_tuning/mcmc_adaptive_multiprop_tuner.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/samplers/mcmc/mcmc_tuning/mcmc_adaptive_multiprop_tuner.jl b/src/samplers/mcmc/mcmc_tuning/mcmc_adaptive_multiprop_tuner.jl index d0139026b..b29dd7898 100644 --- a/src/samplers/mcmc/mcmc_tuning/mcmc_adaptive_multiprop_tuner.jl +++ b/src/samplers/mcmc/mcmc_tuning/mcmc_adaptive_multiprop_tuner.jl @@ -254,8 +254,13 @@ function _tune_picking_rule( ) p_tuned = copy(picking_rule.p) p_tuned[curr_idx] = acc_new - p_tuned .*= (1 - picking_socket) / sum(p_tuned) - p_tuned .+= picking_socket / N + total = sum(p_tuned) + if iszero(total) + fill!(p_tuned, 1 / N) + else + p_tuned .*= (1 - picking_socket) / total + p_tuned .+= picking_socket / N + end return Categorical(p_tuned) end