Microsoft Research Community

SharedVariableArray

rated by 0 users
This post has 1 Reply | 1 Follower

Top 50 Contributor
Posts 14
freddycct Posted: 10-03-2009 11:50 PM

Hi John, 

Thanks for your reply

how do I convert this array here to a SharedVariableArray?

VariableArray<Vector> phi = Variable.Array<Vector>(topicsNumRange);

 

Top 10 Contributor
Posts 56

Hi Freddy

Assuming you split the data into NumChunks chunks, the code would look something like this:

using DirichletArray=DistributionRefArray<Dirichlet, Vector>;
DirichletArray phiPrior new DirichletArray(new Dirichlet(beta));
Range TopicsNum = new Range(K);
SharedVariableArray
<Vector> sharedPhi = SharedVariable<Vector>.Random(TopicsNum, phiPrior);
Model = new Model(NumChunks);
VariableArray<Vector> phi = sharedPhi .GetCopyFor(Model)

Then use phi as before in your model. You will have to explicitly do several passes, looping over the chunks as shown in the documented scalar example.

John

Page 1 of 1 (2 items) | RSS
©2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Feedback