use of dr.inference.model.LatentFactorModel in project beast-mcmc by beast-dev.
the class LoadingsIndependenceOperatorParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
CoercionMode mode = CoercionMode.parseMode(xo);
String scaleFactorTemp = (String) xo.getAttribute(SCALE_FACTOR);
double scaleFactor = Double.parseDouble(scaleFactorTemp);
String weightTemp = (String) xo.getAttribute(WEIGHT);
double weight = Double.parseDouble(weightTemp);
LatentFactorModel LFM = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
DistributionLikelihood prior = (DistributionLikelihood) xo.getChild(DistributionLikelihood.class);
boolean randomScan = xo.getAttribute(RANDOM_SCAN, true);
//To change body of implemented methods use File | Settings | File Templates.
return new LoadingsIndependenceOperator(LFM, prior, weight, randomScan, scaleFactor, mode);
}
use of dr.inference.model.LatentFactorModel in project beast-mcmc by beast-dev.
the class LatentFactorHamiltonianMCParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
LatentFactorModel lfm = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
FullyConjugateMultivariateTraitLikelihood tree = (FullyConjugateMultivariateTraitLikelihood) xo.getChild(FullyConjugateMultivariateTraitLikelihood.class);
double weight = xo.getDoubleAttribute(WEIGHT);
AdaptationMode mode = AdaptationMode.parseMode(xo);
int nSteps = xo.getIntegerAttribute(N_STEPS);
double stepSize = xo.getDoubleAttribute(STEP_SIZE);
double momentumSd = xo.getDoubleAttribute(MOMENTUM_SD);
return new LatentFactorHamiltonianMC(lfm, tree, weight, mode, stepSize, nSteps, momentumSd);
}
use of dr.inference.model.LatentFactorModel in project beast-mcmc by beast-dev.
the class FactorTreeGibbsOperatorParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
String weightTemp = (String) xo.getAttribute(WEIGHT);
double weight = Double.parseDouble(weightTemp);
LatentFactorModel lfm = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
GibbsSampleFromTreeInterface tree = (GibbsSampleFromTreeInterface) xo.getChild(GibbsSampleFromTreeInterface.class);
GibbsSampleFromTreeInterface workingTree = null;
if (xo.getChild(WORKING_PRIOR) != null) {
workingTree = (GibbsSampleFromTreeInterface) xo.getChild(WORKING_PRIOR).getChild(GibbsSampleFromTreeInterface.class);
}
boolean randomScan = xo.getAttribute(RANDOM_SCAN, true);
FactorTreeGibbsOperator lfmOp = new FactorTreeGibbsOperator(weight, lfm, tree, randomScan);
if (xo.hasAttribute(PATH_PARAMETER)) {
System.out.println("WARNING: Setting Path Parameter is intended for debugging purposes only!");
lfmOp.setPathParameter(xo.getDoubleAttribute(PATH_PARAMETER));
}
return lfmOp;
}
use of dr.inference.model.LatentFactorModel in project beast-mcmc by beast-dev.
the class LatentFactorLiabilityGibbsOperatorParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
double weight = xo.getDoubleAttribute(WEIGHT);
LatentFactorModel lfm = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
OrderedLatentLiabilityLikelihood liabilityLikelihood = (OrderedLatentLiabilityLikelihood) xo.getChild(OrderedLatentLiabilityLikelihood.class);
return new LatentFactorLiabilityGibbsOperator(weight, lfm, liabilityLikelihood);
}
use of dr.inference.model.LatentFactorModel in project beast-mcmc by beast-dev.
the class FactorIndependenceOperatorParser method parseXMLObject.
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
AdaptationMode mode = AdaptationMode.parseMode(xo);
String scaleFactorTemp = (String) xo.getAttribute(SCALE_FACTOR);
double scaleFactor = Double.parseDouble(scaleFactorTemp);
String weightTemp = (String) xo.getAttribute(WEIGHT);
double weight = Double.parseDouble(weightTemp);
DiagonalMatrix diffusionMatrix;
diffusionMatrix = (DiagonalMatrix) xo.getChild(DiagonalMatrix.class);
LatentFactorModel LFM = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
boolean randomScan = xo.getAttribute(RANDOM_SCAN, true);
return new FactorIndependenceOperator(LFM, weight, randomScan, diffusionMatrix, scaleFactor, mode);
}
Aggregations