locked
Ask for help with indexing a random Gaussian vector (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • shengbo posted on 03-11-2011 4:27 AM

    hi, I have a naive question about indexing a random Gaussian vector. Imagine that you have an unobserved random vector x and unobserved random variable y; and the relationship between x and y is: y~N(0, x(i)). How can you implement "y~N(0, x(i))" using C#? I have tried to using 

    y = Variable.GaussianFromMeanAndVariance(0, x[i]);

    but I got the following error: 

    Cannot apply indexing with [] to an expression of type 'MicrosoftResearch.Infer.Models.Variable<MicrosoftResearch.Infer.Maths.Vector>'

    Thanks a lot for your time and help! 
    Cheers,
    Shengbo 

    Friday, June 3, 2011 6:31 PM

Answers

  • shengbo replied on 03-11-2011 4:42 AM

    Thanks for your help. I really appreciate that! 

    Cheers,
    Shengbo 

    Friday, June 3, 2011 6:32 PM

All replies

  • minka replied on 03-11-2011 4:35 AM

    To index a random vector you need to use Variable.GetItem:

    y = Variable.GaussianFromMeanAndVariance(0, Variable.GetItem(x,i));

     

    Friday, June 3, 2011 6:32 PM
  • shengbo replied on 03-11-2011 4:42 AM

    Thanks for your help. I really appreciate that! 

    Cheers,
    Shengbo 

    Friday, June 3, 2011 6:32 PM