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
I want to compute the Bethe Free Energy like follows:
@modelfunctioncoin_model(y, a, b)
θ ~Beta(a, b)
for i ineachindex(y)
y[i] ~Bernoulli(θ)
endend
result =infer(
model =coin_model(a =4.0, b =8.0),
data = (y = dataset,)
)
free_energy =compute_free_energy(result.model)
Hi, I may not fully understand your question, but in most cases, the local free energy is defined per node. RxInfer will produce this as an output - you just need to specify it through a keyword argument in the infer function.
result =infer(
model =coin_model(a =4.0, b =8.0),
data = (y = dataset,),
free_energy=true,
)
Inference results:
Posteriors | available for (θ)
Free Energy:| Real[696.125]
As @Nimrais pointed out you simply need to set free_energy flag to true and it will setup the inference function to also compute Bethe Free Energy with every iteration. See an example here.
Note, however, that it is not always possible to compute BFE for all models because sometimes its way too challenging.
I want to compute the Bethe Free Energy like follows:
How to implement the
compute_free_energy
function? @ThijsvdLaar @bvdmitri @alstat @wmkouw @kobus78 Thanks a lot!The text was updated successfully, but these errors were encountered: