Showing related tags and posts across the entire site.
-
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...
Posted to
Infer.NET
by
John Guiver
on 08-14-2009
Filed under: Dirichlet, Variational MessagePassing, Breaking Symmetry
-
hi everyone, What is the difference between Variable.Dirichlet(double[] u) and Variable.Dirichlet(Range valueRange, double[] u)? I tried to use Variable<Vector> pi = Variable.Dirichlet(new double[] { 0.1, 0.1 }); VariableArray<int> z = Variable.Array<int>(n); VariableArray<Vector>...
-
Hi Laura You could make the Dirichlet itself a variable. For example: Variable < Dirichlet > vPrior = Variable .Observed< Dirichlet >( Dirichlet .Uniform(1)); Variable < Vector > vocabDistr = Variable < Vector >.Random(vPrior); Then, when you're ready to infer, set the observed...
-
OK, if that is what you need, then the following C# code will do the job. // Sample data from the true discrete Vector trueProbs = new Vector (0.1, 0.2, 0.3, 0.4); Discrete trueDistrib = new Discrete (trueProbs); int [] data = new int [1000]; for ( int i = 0; i < data.Length; i++) data[ i ] = Rand...
-
Just to summarise everything Laura has noted (many thanks Laura), including the jagged array stuff, here is a modified version of your C# code that will compile and run: static void Main( string [] args) { int K = 3; //number of topics int V = 12; //number of words(terms) in corpus // Documents of variable...