KeyError Setting Mixture Proportions for Mixture Model

I think that you are close to understanding how to use the probabilities as mixture weights. As a first step, you have to write down an explicit model that uses the on and off states. Something like this:

on_{triangle} \sim Bernoulli(p_{on}) triangle \sim Bernoulli(p2_{on_{triangle}})

Where p_{on} is the constant that you chose (0.7), and p2 is an array [1, 0.7], and p2_{on_{triangle}} indexes into said array. This model explicitly samples the a priori hidden on_{triangle} state. I say hidden because I imagine it is unobserved. Now, you may see that there is no mixture distribution in the math written above. To get the mixture, one assumes that the on_{triangle} discrete state is not observed, the only thing that is observed is the final triangle state, so you can sum over the the possible values of on_{triangle} (this gives you the marginal probability distribution) and reads as follows:

triangle \sim (1-p_{on}) Bernoulli(p2_{0}) +p_{on} Bernoulli(p2_{1}) = Mixture(w, [Bernoulli(p2_{0}), Bernoulli(p2_{1})]

Where w=[(1-p_{on}), p_{on}]. This second parametrization gives you the same probability distribution for sampling triangle but you removed the discrete on_triangle variable by marginalizing out and getting a mixture model written down. This is what I meant by using the probabilities directly. You should check out the examples of mixture models on our website. There one in particular about the two parametrizations of a mixture model, I’ve with the latent variable and one without, and talks about the differences.

1 Like