Changing prior for Dirichlet distributed RV RRS feed

  • Question

  • Hi,

    It is fairly simple to create a random variable that has Dirichlet distribution attached to it. This creates a random variable 'x' with a static and fixed (to my understanding) RV with specified parameters.

    Variable<Vector> x = Variable.Dirichlet(new double[] { 1.0, 1.0, 1.0});

    Is it possible to define a random variable with Dirichlet distribution for which the prior can be changed runtime? Something like this:

    Variable<Dirichlet> xPrior = new Dirichlet(new double[] {1.0, 2.0, 1.0});
    Variable<Vector> x = new Variable.Random<?, Dirichlet>(xPrior);

    In my application, I have a VariableArray<Vector> array where each element is Dirichlet distributed RV. As observations come in, I infer the model parameters and use the posteriors as priors for next iteration, with a new batch of data.

    The complete code is on Github: "Infer.NET-MACE" project for user "<g class="gr_ gr_26 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="26" id="26">usptact</g>".

    • Edited by usptact Wednesday, August 30, 2017 4:49 AM
    Wednesday, August 30, 2017 4:47 AM


  • Yes, and the code above is basically it.  Use x = Variable<Vector>.Random(xPrior);
    • Marked as answer by usptact Wednesday, August 30, 2017 7:57 AM
    Wednesday, August 30, 2017 7:47 AM