Partial (or Marginal) MAP computation?

24 views
Skip to first unread message

Johan Kwisthout

unread,
Jul 20, 2020, 5:14:41 PM7/20/20
to libDAI
Hi all,

What would be a convenient way to compute a partial MAP in a Bayesian network using the junction tree algorithm? I managed to compute most probable explanations as follows:

std::vector<unsigned long int> get_mpe(dai::FactorGraph fg, std::vector<unsigned long int> evidence_vars, std::vector<unsigned long int> evidence_values)
{
    std::vector<unsigned long int> mpe;

    // set the evidence in the network
    for (int i = 0; i < evidence_vars.size(); i++)
    {
        fg.clamp(evidence_vars[i], evidence_values[i], false);
    }
   
    dai::PropertySet opts;
    dai::JTree jt = dai::JTree(fg, opts("updates",std::string("HUGIN"))("inference",std::string("MAXPROD")));
    jt.init();
    jt.run();
    mpe = jt.findMaximum();

    return mpe;
}

However, this computes the maximum over all non-clamped variables, and I'd like to compute the maximum over a subset of those, marginalizing over others. In short, compute $\argmax_{h} Pr(h, e) = \argmax_{h} \sum_{i} Pr(h, i, e)$ where we marginalize over all non-evidence, non-explanation variables.

thanks for your advise!

best
Johan

Joris Mooij

unread,
Jul 21, 2020, 3:50:50 AM7/21/20
to Johan Kwisthout, libDAI
Hi Johan,

good question. I am not sure whether that is easily possible with libDAI.
If there is no trick which reduces this to either a full marginalization
or a full maximization, my guess is that this would require extending the
JunctionTree class to provide that functionality.

Best wishes,
Joris
> --
> You received this message because you are subscribed to the Google Groups
> "libDAI" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to libdai+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/
> libdai/1c8b85c5-c34d-4b1b-8d72-d2dea07022f6o%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages