AutoregressiveMessagePassingRules
The message passing rules of the autoregressive nodes, for Bayesian autoregressive processes whose coefficients and noise precision are learnt with the states. Use AR when the coefficients and the precision have priors of their own, a normal and a gamma, and ConjugateAR when they share a normal-gamma prior, which makes their update conjugate. The rules are variational: a model using either node gives the algorithm ARVMP and a factorisation.
AutoregressiveMessagePassingRules — Module
AutoregressiveMessagePassingRulesThe autoregressive nodes, for Bayesian autoregressive processes of order p, yₜ ~ N(θᵀxₜ, γ⁻¹) with xₜ = (yₜ₋₁, …, yₜ₋ₚ):
AR(aliasAutoregressive): the coefficientsθand the precisionγon edges of their own;ConjugateAR:(θ, γ)joint on oneMvNormalGammaedgew, which makes the parameter update conjugate.
Their rules run under ARVMP(form, order, stype), which the model must give: the nodes declare no algorithm, and under DefaultAlgorithm no rule exists. stype is ARsafe() or ARunsafe(), the way the joint q(y, x) is formed. The rules are variational, under the structured factorisation q(y, x) q(θ) q(γ) (q(y, x) q(w)) or the mean field, and both nodes have an average energy.
Examples
julia> algorithm = ARVMP(Multivariate, 2, ARsafe());
julia> result = @call_message_update_rule(
node = AR, target = :γ, algorithm = algorithm,
clusters = ((:y, :x) => MvNormalMeanCovariance(ones(4), [1.0 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1]),),
q = (θ = MvNormalMeanCovariance([0.5, 0.25], [1.0 0.0; 0.0 1.0]),),
);
julia> shape(getresult(result)) ≈ 1.5 && rate(getresult(result)) ≈ 2.6875
trueReactiveMP runs these rules on a factor graph, which RxInfer builds from a GraphPPL model. The examples here call the rules directly, as a test does.
Example
A message towards the state y of a univariate AR(1), from the message on the previous state and the marginals of the coefficient and the precision, run with @call_message_update_rule:
julia> result = @call_message_update_rule(
node = AR, target = :y, algorithm = ARVMP(Univariate, 1, ARsafe()),
m = (x = NormalMeanVariance(1.0, 1.0),),
q = (θ = NormalMeanVariance(1.0, 1.0), γ = GammaShapeRate(1.0, 1.0)),
);
julia> mean_var(getresult(result)) .≈ (0.5, 1.5)
(true, true)The site
- AR: the node with the coefficients and the precision on edges of their own, its algorithm
ARVMPand the two modesARsafeandARunsafe; - ConjugateAR: the node with them joint on one normal-gamma edge.