Search in sources :

Example 1 with HierarchicalGraphLikelihood

use of dr.inference.distribution.HierarchicalGraphLikelihood in project beast-mcmc by beast-dev.

the class HierarchicalGraphLikelihoodParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(HIERARCHICAL_INDICATOR);
    Parameter hierarchicalIndicator = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(STRATA_INDICATOR);
    MatrixParameter strataIndicatorMatrix = new MatrixParameter("matrix");
    int dim = 0;
    for (int i = 0; i < cxo.getChildCount(); i++) {
        Parameter parameter = (Parameter) cxo.getChild(i);
        strataIndicatorMatrix.addParameter(parameter);
        if (i == 0)
            dim = parameter.getDimension();
        else if (dim != parameter.getDimension())
            throw new XMLParseException("All parameters must have the same dimension to construct a rectangular matrix");
    }
    if (hierarchicalIndicator.getDimension() != strataIndicatorMatrix.getRowDimension())
        throw new XMLParseException("Hierarchical and starta parameters don't have the same dimentions");
    cxo = xo.getChild(PROB);
    Parameter prob = (Parameter) cxo.getChild(Parameter.class);
    return new HierarchicalGraphLikelihood(hierarchicalIndicator, strataIndicatorMatrix, prob);
}
Also used : MatrixParameter(dr.inference.model.MatrixParameter) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) HierarchicalGraphLikelihood(dr.inference.distribution.HierarchicalGraphLikelihood)

Aggregations

HierarchicalGraphLikelihood (dr.inference.distribution.HierarchicalGraphLikelihood)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Parameter (dr.inference.model.Parameter)1