Below we provide a Python implementation of the continuous Bernoulli distributions: CB(L), parametrized by the log odds L and adjusted to the [-1,1] interval.
def CB(x, b, logodds=True):
if not logodds:
b=np.log(b/(1-b))
if np.isclose(b, 0):
return np.ones_like(x)/2
else:
return b * np.exp(b*x) / (2*np.sinh(b))
# Plot some examples
delta = 100
sigma = np.linspace(-1, 1, delta)
for b in np.linspace(-2, 2, 5):
p_sigma = CB(sigma, b)
sns.lineplot(x=sigma, y=p_sigma, label=b)
Let x∈Rn denote the system’s states (internal, blanket, and external states).
The drift can be decomposed into a gradient part (from a potential U) and a solenoidal part R:
x˙=−∇U(x)+R(x)
where R=−RT is antisymmetric in state‐space.
The probability density p(x,t) over states evolves according to the Fokker–Planck equation:
∂tp(x,t)=−∇⋅[(−∇U+R)p(x,t)]+diffusionterms.
To determine the stationary distribution ps(x), we set ∂tp(x,t)=0. The Fokker-Planck equation then implies that the net probability current Js(x)=(−∇U(x)+R(x))ps(x)−D∇ps(x) (assuming isotropic diffusion D) must be divergence-free: ∇⋅Js(x)=0.
If we propose ps(x)=Z−1exp(−U(x)/D) (where Z is a normalization constant), then the diffusive current −D∇ps(x) becomes ps(x)∇U(x).
Thus, ps(x)∝exp(−U(x)/D) is the stationary distribution if and only if the solenoidal component of the probability current, JR(x)=R(x)ps(x), is itself divergence-free: ∇⋅(R(x)ps(x))=0.
It is a key result from the study of non-equilibrium systems under the Free Energy Principle, particularly those possessing a Markov blanket and involving conservative particles, that this condition ∇⋅(R(x)ps(x))=0 holds (see Friston et al., 2023; but also related: Ao (2004); Xing (2010)). The conditional independence structure imposed by the Markov blanket, along with other FEP-specific assumptions (like conservative particles), constrains the system’s dynamics such that solenoidal forces R(x) do not alter the Boltzmann form of the stationary distribution. Instead, they drive persistent, divergence-free probability currents JR(x) along iso-potential surfaces.
In steady state (∂tp=0), only the gradient term −∇U influences p(x). The stationary (nonequilibrium) distribution is
p(x)∝exp−U(x),
determined solely by the symmetric (potential) part −∇U. The antisymmetric R does not reweight p(x); it just circulates probability around isocontours of U.
In most NESS systems, antisymmetric flows do alter the stationary measure. Under particular‐partition (Markov‐blanket) constraints, however, the internal–external factorization ensures that solenoidal (antisymmetric) flows remain divergence‐free, leaving the Boltzmann‐like steady distribution intact.
This is why, in these Markov‐blanketed systems, one can have persistent solenoidal currents (nonequilibrium flows) yet preserve a stationary distribution that depends only on the symmetric part of the couplings.
Setting the derivative to zero and solving for bq, we get:
bq=b+∑j=iJijσj
Now we remember that the expected value of the CB is the Langevin function of its bias -, E(x)=coth(b)−1/b (). For simplicity, we will denote it as L(x). Now we can write:
Eq[σi]=L(bq)=L(b+∑j=iJijσj)
Friston, K., Da Costa, L., Sakthivadivel, D. A. R., Heins, C., Pavliotis, G. A., Ramstead, M., & Parr, T. (2023). Path integrals, particular kinds, and strange things. Physics of Life Reviews, 47, 35–62. 10.1016/j.plrev.2023.08.016
Ao, P. (2004). Potential in stochastic differential equations: novel construction. Journal of Physics A: Mathematical and General, 37(3), L25–L30. 10.1088/0305-4470/37/3/l01
Xing, J. (2010). Mapping between dissipative and Hamiltonian systems. Journal of Physics A: Mathematical and Theoretical, 43(37), 375003. 10.1088/1751-8113/43/37/375003