# Hybrid Network Inference

#### Mark Balmer

##### New Member
I'm trying to figure out how to calculate the result mean and variance for a simple hybrid bayesian network comprised of 2 variables (to keep things simple for now).

The nodes are B (discrete) and C (continuous); C being a child node of B.

The distribution of B is:
B=stable 0.85
B=unstable 0.15

The distribution of C is:
C | B=stable $$N(-2,0.1)$$
C | B=unstable $$N(-1,0.3)$$

If we assume a clique of $$\left \{ B,C \right \}$$ with the potentials $$P(B)$$ and $$P(C|B)$$ assigned to it. By the literature being followed, we need to initialise these potentials in a canonical form.

Therefore the initialisation of $$B$$ is:

$$g_{B}(stable) = log(0.85) = -0.16252$$

$$h_{B}(stable) = 0$$

$$k_{B}(stable) = 0$$

$$g_{B}(stable) = log(0.15) = -1.89712$$

$$h_{B}(stable) = 0$$

$$k_{B}(stable) = 0$$

The initialisation of $$C$$ is:

$$g_{C}(stable) = -\frac{(-2)^{2}}{2*0.1}-\left \{ log(2\pi *0.1) \right \}/2=-19.76765$$

$$h_{C}(stable) = -2/0.1=-20$$

$$k_{C}(stable) = 1/0.1=10$$

$$g_{C}(unstable) = -\frac{(-1)^{2}}{2*0.3}-\left \{ log(2\pi *0.3) \right \}/2=-1.98362$$

$$h_{C}(unstable) = -1/0.3=-3.33333$$

$$k_{C}(unstable) = 1/0.3=3.33333$$

We add the canonical forms together to produce the canonical form for $$B,C$$:

$$g_{B,C}(stable) = -19.9302$$

$$h_{B,C}(stable) = -20$$

$$k_{B,C}(stable) = 10$$

$$g_{B,C}(unstable) = -3.88074$$

$$h_{B,C}(unstable) = -3.33333$$

$$k_{B,C}(unstable) = 3.33333$$

When I use Hugin I get the result for $$C$$ - $$\mu_{C}=-1.85, \sigma ^{2}=0.257049$$. Now,I can achieve those same values without performing the canonical transformation, but what I want to know is how do I get those result values from the canonical forms in the potentials?