use of dr.inference.operators.UniformOperator in project beast-mcmc by beast-dev.
the class GibbsSubtreeSwapTestProblem method getOperatorSchedule.
public OperatorSchedule getOperatorSchedule(TreeModel treeModel) {
Parameter rootParameter = treeModel.createNodeHeightsParameter(true, false, false);
Parameter internalHeights = treeModel.createNodeHeightsParameter(false, true, false);
GibbsSubtreeSwap operator = new GibbsSubtreeSwap(treeModel, false, 1.0);
ScaleOperator scaleOperator = new ScaleOperator(rootParameter, 0.75, CoercionMode.COERCION_ON, 1.0);
UniformOperator uniformOperator = new UniformOperator(internalHeights, 1.0);
OperatorSchedule schedule = new SimpleOperatorSchedule();
schedule.addOperator(operator);
schedule.addOperator(scaleOperator);
schedule.addOperator(uniformOperator);
return schedule;
}
use of dr.inference.operators.UniformOperator in project beast-mcmc by beast-dev.
the class UniformOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
Parameter parameter = (Parameter) xo.getChild(Parameter.class);
if (parameter.getDimension() == 0) {
throw new XMLParseException("parameter with 0 dimension.");
}
Double lower = null;
Double upper = null;
if (xo.hasAttribute(LOWER)) {
lower = xo.getDoubleAttribute(LOWER);
}
if (xo.hasAttribute(UPPER)) {
upper = xo.getDoubleAttribute(UPPER);
}
return new UniformOperator(parameter, weight, lower, upper);
}
use of dr.inference.operators.UniformOperator in project beast-mcmc by beast-dev.
the class NarrowExchangeTest method getOperatorSchedule.
public OperatorSchedule getOperatorSchedule(TreeModel treeModel) {
Parameter rootParameter = treeModel.createNodeHeightsParameter(true, false, false);
Parameter internalHeights = treeModel.createNodeHeightsParameter(false, true, false);
ExchangeOperator operator = new ExchangeOperator(ExchangeOperator.NARROW, treeModel, 1.0);
ScaleOperator scaleOperator = new ScaleOperator(rootParameter, 0.75, CoercionMode.COERCION_ON, 1.0);
UniformOperator uniformOperator = new UniformOperator(internalHeights, 1.0);
OperatorSchedule schedule = new SimpleOperatorSchedule();
schedule.addOperator(operator);
schedule.addOperator(scaleOperator);
schedule.addOperator(uniformOperator);
return schedule;
}
Aggregations