Search in sources :

Example 1 with TraitValidationProvider

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

the class TraitValidationProviderParser method parseTraitValidationProvider.

public static TraitValidationProvider parseTraitValidationProvider(XMLObject xo) throws XMLParseException {
    String trueValuesName = xo.getStringAttribute(TreeTraitParserUtilities.TRAIT_NAME);
    String inferredValuesName = xo.getStringAttribute(INFERRED_NAME);
    TreeDataLikelihood treeLikelihood = (TreeDataLikelihood) xo.getChild(TreeDataLikelihood.class);
    ContinuousDataLikelihoodDelegate delegate = (ContinuousDataLikelihoodDelegate) treeLikelihood.getDataLikelihoodDelegate();
    ContinuousTraitPartialsProvider dataModel = delegate.getDataModel();
    Tree treeModel = treeLikelihood.getTree();
    TreeTraitParserUtilities utilities = new TreeTraitParserUtilities();
    TreeTraitParserUtilities.TraitsAndMissingIndices returnValue = utilities.parseTraitsFromTaxonAttributes(xo, trueValuesName, treeModel, true);
    Parameter trueParameter = returnValue.traitParameter;
    List<Integer> trueMissing = returnValue.missingIndices;
    Parameter missingParameter = null;
    if (xo.hasChildNamed(MASK)) {
        missingParameter = (Parameter) xo.getElementFirstChild(MASK);
    }
    String id = xo.getId();
    TraitValidationProvider provider = new TraitValidationProvider(trueParameter, dataModel, treeModel, id, missingParameter, treeLikelihood, inferredValuesName, trueMissing);
    return provider;
}
Also used : TreeDataLikelihood(dr.evomodel.treedatalikelihood.TreeDataLikelihood) Tree(dr.evolution.tree.Tree) TreeTraitParserUtilities(dr.evomodelxml.treelikelihood.TreeTraitParserUtilities) Parameter(dr.inference.model.Parameter) ContinuousDataLikelihoodDelegate(dr.evomodel.treedatalikelihood.continuous.ContinuousDataLikelihoodDelegate) ContinuousTraitPartialsProvider(dr.evomodel.treedatalikelihood.continuous.ContinuousTraitPartialsProvider) TraitValidationProvider(dr.inference.model.TraitValidationProvider)

Example 2 with TraitValidationProvider

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

the class TraitValidationParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    TraitValidationProvider provider = TraitValidationProviderParser.parseTraitValidationProvider(xo);
    boolean logSum = xo.getAttribute(CrossValidatorParser.LOG_SUM, false);
    if (logSum)
        return new CrossValidationProvider.CrossValidatorSum(provider);
    return new CrossValidationProvider.CrossValidator(provider);
}
Also used : CrossValidationProvider(dr.inference.model.CrossValidationProvider) TraitValidationProvider(dr.inference.model.TraitValidationProvider)

Aggregations

TraitValidationProvider (dr.inference.model.TraitValidationProvider)2 Tree (dr.evolution.tree.Tree)1 TreeDataLikelihood (dr.evomodel.treedatalikelihood.TreeDataLikelihood)1 ContinuousDataLikelihoodDelegate (dr.evomodel.treedatalikelihood.continuous.ContinuousDataLikelihoodDelegate)1 ContinuousTraitPartialsProvider (dr.evomodel.treedatalikelihood.continuous.ContinuousTraitPartialsProvider)1 TreeTraitParserUtilities (dr.evomodelxml.treelikelihood.TreeTraitParserUtilities)1 CrossValidationProvider (dr.inference.model.CrossValidationProvider)1 Parameter (dr.inference.model.Parameter)1