Search in sources :

Example 1 with HessianProvider

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

the class HessianWrapperParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Object obj = xo.getChild(0);
    if (obj instanceof MultivariateDistributionLikelihood) {
        final MultivariateDistributionLikelihood mdl = (MultivariateDistributionLikelihood) xo.getChild(MultivariateDistributionLikelihood.class);
        if (!(mdl.getDistribution() instanceof HessianProvider)) {
            throw new XMLParseException("Not a hessian provider");
        }
        final HessianProvider provider = (HessianProvider) mdl.getDistribution();
        final Parameter parameter = mdl.getDataParameter();
        return new HessianWrtParameterProvider.ParameterWrapper(provider, parameter, mdl);
    } else {
        DistributionLikelihood dl = (DistributionLikelihood) obj;
        if (!(dl.getDistribution() instanceof HessianProvider)) {
            throw new XMLParseException("Not a hessian provider");
        }
        final HessianProvider provider = (HessianProvider) dl.getDistribution();
        final Parameter parameter = (Parameter) xo.getChild(Parameter.class);
        return new HessianWrtParameterProvider.ParameterWrapper(provider, parameter, dl);
    }
}
Also used : MultivariateDistributionLikelihood(dr.inference.distribution.MultivariateDistributionLikelihood) Parameter(dr.inference.model.Parameter) HessianProvider(dr.inference.model.HessianProvider) DistributionLikelihood(dr.inference.distribution.DistributionLikelihood) MultivariateDistributionLikelihood(dr.inference.distribution.MultivariateDistributionLikelihood)

Aggregations

DistributionLikelihood (dr.inference.distribution.DistributionLikelihood)1 MultivariateDistributionLikelihood (dr.inference.distribution.MultivariateDistributionLikelihood)1 HessianProvider (dr.inference.model.HessianProvider)1 Parameter (dr.inference.model.Parameter)1