BIFM node
See also BIFM tutorial for a comprehensive guide on using BIFM node in RxInfer.jl
.
ReactiveMP.BIFM
— TypeThe BIFM node is a node that can be used as a substitution for a state space model. It includes all factor of the time slice to perform efficient inference. This node needs to be used in conjuction with the BIFMHelper node for efficient inference.
out ~ BIFM(in, zprev, znext)
Interfaces:
- out - latent output (observation) of the BIFM node
- in - latent input of the BIFM node
- zprev - previous latent state of the BIFM node
- znext - next latent state of the BIFM node
Note: When performing inference, first subscribe to the marginals (in the order: z, out, in) and then to the free energy score function.
Example
# set priors
z_prior ~ MvNormalMeanPrecision(zeros(latent_dim), diagm(ones(latent_dim)))
z_tmp ~ BIFMHelper(z_prior)
# update last/previous hidden state
z_prev = z_tmp
# loop through observations
for i in 1:nr_samples
# specify input as random variable
u[i] ~ MvNormalMeanPrecision(μu, Wu)
# specify observation
xt[i] ~ BIFM(u[i], z_prev, z[i]) where { meta = BIFMMeta(A, B, C) }
x[i] ~ MvNormalMeanPrecision(xt[i], Wx)
# update last/previous hidden state
z_prev = z[i]
end
ReactiveMP.BIFMMeta
— TypeThe BIFMMeta structure contains all characterizing information of the BIFM node. In addition, it stores intermediate variables for efficient computations.
ReactiveMP.BIFMHelper
— TypeThe BIFMHelper node is a node required to perform efficient message passing inconjuction with the BIFM node. It is required to switch from the backward pass with messages to the forward pass with marginals.
out ~ BIFMHelper(in)
Interfaces:
- out - output of the BIFMHelper node, should be connected to the state space model.
- in - input of the BIFMHelper node, should be connected to the prior for the latent state.
Note: When performing inference, first subscribe to the marginals (in the order: z, out, in) and then to the free energy score function.