Search in sources :

Example 1 with UniformOperator

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;
}
Also used : SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) OperatorSchedule(dr.inference.operators.OperatorSchedule) SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) GibbsSubtreeSwap(dr.evomodel.operators.GibbsSubtreeSwap) Parameter(dr.inference.model.Parameter) UniformOperator(dr.inference.operators.UniformOperator) ScaleOperator(dr.inference.operators.ScaleOperator)

Example 2 with UniformOperator

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);
}
Also used : Parameter(dr.inference.model.Parameter) UniformOperator(dr.inference.operators.UniformOperator)

Example 3 with UniformOperator

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;
}
Also used : SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) OperatorSchedule(dr.inference.operators.OperatorSchedule) SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) ExchangeOperator(dr.evomodel.operators.ExchangeOperator) Parameter(dr.inference.model.Parameter) UniformOperator(dr.inference.operators.UniformOperator) ScaleOperator(dr.inference.operators.ScaleOperator)

Aggregations

Parameter (dr.inference.model.Parameter)3 UniformOperator (dr.inference.operators.UniformOperator)3 OperatorSchedule (dr.inference.operators.OperatorSchedule)2 ScaleOperator (dr.inference.operators.ScaleOperator)2 SimpleOperatorSchedule (dr.inference.operators.SimpleOperatorSchedule)2 ExchangeOperator (dr.evomodel.operators.ExchangeOperator)1 GibbsSubtreeSwap (dr.evomodel.operators.GibbsSubtreeSwap)1