Skip to content

PseudoNormalBlockState incompatibility with mcmc_equlibrate()

I'm using graph_tool v 2.97. I've noticed that when PseudoNormalBlockState mcmc_sweep() returns 2 values with default initialization and 3 values if L1 regularization is requested. In the former case, it doesn't work with gt.mcmc_equilibrate(). Example: This works:

a = np.random.randn(1000).reshape((10, 100))
state = gt.PseudoNormalBlockState(a, 
                                 disable_xdist=True, 
                                 disable_tdist=True)
gt.mcmc_equilibrate(state, force_niter=10)

This fails:

a = np.random.randn(1000).reshape((10, 100))
state = gt.PseudoNormalBlockState(a)
gt.mcmc_equilibrate(state, force_niter=10)

with this error

File ~/miniforge3/envs/sc04/lib/python3.12/site-packages/graph_tool/inference/mcmc.py:127, in mcmc_equilibrate(state, wait, nbreaks, max_niter, force_niter, epsilon, gibbs, multiflip, mcmc_args, entropy_args, history, callback, verbose)
    125     delta, nattempts, nmoves = state.multiflip_mcmc_sweep(**mcmc_args)
    126 else:
--> 127     delta, nattempts, nmoves = state.mcmc_sweep(**mcmc_args)
    129 S += delta
    130 niter += 1

ValueError: not enough values to unpack (expected 3, got 2)