-
Firstly, you do need the Variable < int > s = Variable .New< int >() and the s.SetTo( Variable .Discrete(alpha[t, q])) if you are dealing with just a single data point (if you have an array, see below). Secondly, you should use Variational Message passing for this inference rather than Expectation...