Search in sources :

Example 1 with ThreadedCompoundLikelihood

use of dr.inference.model.ThreadedCompoundLikelihood in project beast-mcmc by beast-dev.

the class ThreadedCompoundLikelihoodParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    ThreadedCompoundLikelihood compoundLikelihood = new ThreadedCompoundLikelihood();
    for (int i = 0; i < xo.getChildCount(); i++) {
        if (xo.getChild(i) instanceof Likelihood) {
            compoundLikelihood.addLikelihood((Likelihood) xo.getChild(i));
        } else {
            Object rogueElement = xo.getChild(i);
            throw new XMLParseException("An element (" + rogueElement + ") which is not a likelihood has been added to a " + THREADED_COMPOUND_LIKELIHOOD + " element");
        }
    }
    double weight = xo.getAttribute(WEIGHT, 0.0);
    if (weight < 0)
        throw new XMLParseException("Robust weight must be non-negative.");
    compoundLikelihood.setWeightFactor(Math.exp(-weight));
    return compoundLikelihood;
}
Also used : ThreadedCompoundLikelihood(dr.inference.model.ThreadedCompoundLikelihood) Likelihood(dr.inference.model.Likelihood) ThreadedCompoundLikelihood(dr.inference.model.ThreadedCompoundLikelihood)

Aggregations

Likelihood (dr.inference.model.Likelihood)1 ThreadedCompoundLikelihood (dr.inference.model.ThreadedCompoundLikelihood)1