I'm new to TFP, so this may be a stupid question.
I want to construct a mixture model out of a custom kernel which is a product distribution of three separate distributions. The random variable is a 7D vector x = (t1, t2, t3, r1, r2, r3, a), and is modelled as:
P(x | mu, sigma, r0, kr, a0, ka) = P_t (t | mu, sigma) P_r (r | r0, kr) P_a (a | a0, ka)
where t = (t1, t2, t3), r = (r1, r2, r3) in the above expression. mu is a 3D vector, sigma is a 3x3 diagonal covariance matrix, so can be expressed essentially as a 3D vector again.
r0 is a 3D vector. kr, ka, a0 are scalars.
I expressed the three factors as three different distributions according to my particular problem: P_t as a tfp.MultiVAriateNormalDiag, P_r as a tfp.VonMisesFisher and P_a as a tfp.VonMises distribution. Here's the code snippet:
# helper function to calculate a positive scale factor
def get_scale(dim=None, name="scale"):
init_val = 1.0 if dim is None else tf.ones(dim)
return tfp.util.TransformedVariable(init_val, bijector=tfb.Softplus(), name=name)
# factor definitions
P_t = tfd.MultivariateNormalDiag(loc=tf.Variable(tf.zeros(3), name="mu"),
P_r = tfd.VonMisesFisher(mean_direction=tf.Variable([1.0, 0.0, 0.0], name="r0"),
P_a = tfd.VonMises(loc=tf.Variable(0.0, name="a0"),
Now I need a joint distribution P_tot = P_t * P_r * P_a, which I intend to use as the components_distribution in a tfd.MixtureSameFamily distribution.
But, I can't seem to find a way to define this composite product distribution P_tot. I read the "Factorial Mixture" notebook, but didn't help. Not sure if (and how) tfd.Indepndent can be used here to define P_tot as the product written above.
Any pointers would be awesome!