Search in sources :

Example 1 with BranchSpecificSubstitutionParameterBranchModel

use of dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel in project beast-mcmc by beast-dev.

the class BranchSubstitutionParameterGradientParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String traitName = xo.getAttribute(TRAIT_NAME, DEFAULT_TRAIT_NAME);
    boolean useHessian = xo.getAttribute(USE_HESSIAN, false);
    final TreeDataLikelihood treeDataLikelihood = (TreeDataLikelihood) xo.getChild(TreeDataLikelihood.class);
    BranchSpecificSubstitutionParameterBranchModel branchModel = (BranchSpecificSubstitutionParameterBranchModel) xo.getChild(BranchModel.class);
    BeagleDataLikelihoodDelegate beagleData = (BeagleDataLikelihoodDelegate) treeDataLikelihood.getDataLikelihoodDelegate();
    BranchRateModel branchRateModel = (BranchRateModel) xo.getChild(BranchRateModel.class);
    CompoundParameter branchParameter = branchModel.getBranchSpecificParameters(branchRateModel);
    return new BranchSubstitutionParameterGradient(traitName, treeDataLikelihood, beagleData, branchParameter, branchRateModel, useHessian);
}
Also used : CompoundParameter(dr.inference.model.CompoundParameter) TreeDataLikelihood(dr.evomodel.treedatalikelihood.TreeDataLikelihood) BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) BranchSpecificSubstitutionParameterBranchModel(dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel) BeagleDataLikelihoodDelegate(dr.evomodel.treedatalikelihood.BeagleDataLikelihoodDelegate) BranchSubstitutionParameterGradient(dr.evomodel.treedatalikelihood.discrete.BranchSubstitutionParameterGradient) BranchSpecificSubstitutionParameterBranchModel(dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel) BranchModel(dr.evomodel.branchmodel.BranchModel)

Example 2 with BranchSpecificSubstitutionParameterBranchModel

use of dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel in project beast-mcmc by beast-dev.

the class BranchSpecificSubstitutionParameterBranchModelParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    List<Parameter> parameters = new ArrayList<>();
    for (XMLObject xoc : xo.getAllChildren(OLD_PARAMETER)) {
        Parameter parameter = (Parameter) xoc.getChild(Parameter.class);
        parameters.add(parameter);
    }
    List<BranchRateModel> branchRateModels = new ArrayList<>();
    for (XMLObject xoc : xo.getAllChildren(NEW_PARAMETER)) {
        BranchRateModel branchRateModel = (BranchRateModel) xoc.getChild(BranchRateModel.class);
        branchRateModels.add(branchRateModel);
    }
    ParameterReplaceableSubstitutionModel substitutionModel = (ParameterReplaceableSubstitutionModel) xo.getChild(ParameterReplaceableSubstitutionModel.class);
    TreeModel tree = (TreeModel) xo.getChild(TreeModel.class);
    return new BranchSpecificSubstitutionParameterBranchModel(BRANCH_SPECIFIC_SUBSTITUTION_PARAMETER_BRANCH_MODEL, parameters, branchRateModels, substitutionModel, tree);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) ArrayList(java.util.ArrayList) ParameterReplaceableSubstitutionModel(dr.evomodel.substmodel.ParameterReplaceableSubstitutionModel) Parameter(dr.inference.model.Parameter) BranchSpecificSubstitutionParameterBranchModel(dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel)

Aggregations

BranchSpecificSubstitutionParameterBranchModel (dr.evomodel.branchmodel.BranchSpecificSubstitutionParameterBranchModel)2 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)2 BranchModel (dr.evomodel.branchmodel.BranchModel)1 ParameterReplaceableSubstitutionModel (dr.evomodel.substmodel.ParameterReplaceableSubstitutionModel)1 TreeModel (dr.evomodel.tree.TreeModel)1 BeagleDataLikelihoodDelegate (dr.evomodel.treedatalikelihood.BeagleDataLikelihoodDelegate)1 TreeDataLikelihood (dr.evomodel.treedatalikelihood.TreeDataLikelihood)1 BranchSubstitutionParameterGradient (dr.evomodel.treedatalikelihood.discrete.BranchSubstitutionParameterGradient)1 CompoundParameter (dr.inference.model.CompoundParameter)1 Parameter (dr.inference.model.Parameter)1 ArrayList (java.util.ArrayList)1