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;
}
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);
}
Aggregations