Search in sources :

Example 1 with MaximizerWrtParameter

use of dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter in project beast-mcmc by beast-dev.

the class MaximizerWrtParameterOperatorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    MaximizerWrtParameter maximizerWrtParameter = (MaximizerWrtParameter) xo.getChild(MaximizerWrtParameter.class);
    final int maxSteps = xo.getAttribute(MAX_STEPS, Integer.MAX_VALUE);
    return new MaximizerWrtParameterOperator(maximizerWrtParameter, maxSteps, weight);
}
Also used : MaximizerWrtParameterOperator(dr.inference.operators.MaximizerWrtParameterOperator) MaximizerWrtParameter(dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter)

Example 2 with MaximizerWrtParameter

use of dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter in project beast-mcmc by beast-dev.

the class MaximizeWrtParameterParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    GradientWrtParameterProvider gradient = (GradientWrtParameterProvider) xo.getChild(GradientWrtParameterProvider.class);
    Parameter parameter;
    Likelihood likelihood;
    int nIterations = Math.abs(xo.getAttribute(N_ITERATIONS, 0));
    boolean initialGuess = xo.getAttribute(INITIAL_GUESS, true);
    boolean printScreen = xo.getAttribute(PRINT_SCREEN, false);
    if (gradient != null) {
        parameter = gradient.getParameter();
        likelihood = gradient.getLikelihood();
    } else {
        XMLObject cxo = xo.getChild(DENSITY);
        parameter = (Parameter) cxo.getChild(Parameter.class);
        likelihood = (Likelihood) cxo.getChild(Likelihood.class);
    }
    Transform transform = (Transform) xo.getChild(Transform.class);
    MaximizerWrtParameter maximizer = new MaximizerWrtParameter(likelihood, parameter, gradient, transform, new MaximizerWrtParameter.Settings(nIterations, initialGuess, printScreen));
    maximizer.maximize();
    return maximizer;
}
Also used : Likelihood(dr.inference.model.Likelihood) GradientWrtParameterProvider(dr.inference.hmc.GradientWrtParameterProvider) Parameter(dr.inference.model.Parameter) MaximizerWrtParameter(dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter) Transform(dr.util.Transform) MaximizerWrtParameter(dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter)

Example 3 with MaximizerWrtParameter

use of dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter in project beast-mcmc by beast-dev.

the class TreeMaximizationOperatorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    int maxSteps = (int) xo.getAttribute(MAX_STEP, 20);
    MaximizerWrtParameter maximizerWrtParameter = (MaximizerWrtParameter) xo.getChild(MaximizerWrtParameter.class);
    SimpleMCMCOperator treeOperator = (SimpleMCMCOperator) xo.getChild(MCMCOperator.class);
    return new TreeMaximizationOperator(treeOperator, maximizerWrtParameter, maxSteps, weight);
}
Also used : SimpleMCMCOperator(dr.inference.operators.SimpleMCMCOperator) MaximizerWrtParameter(dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter) MCMCOperator(dr.inference.operators.MCMCOperator) SimpleMCMCOperator(dr.inference.operators.SimpleMCMCOperator) TreeMaximizationOperator(dr.inference.operators.TreeMaximizationOperator)

Aggregations

MaximizerWrtParameter (dr.evomodel.treedatalikelihood.discrete.MaximizerWrtParameter)3 GradientWrtParameterProvider (dr.inference.hmc.GradientWrtParameterProvider)1 Likelihood (dr.inference.model.Likelihood)1 Parameter (dr.inference.model.Parameter)1 MCMCOperator (dr.inference.operators.MCMCOperator)1 MaximizerWrtParameterOperator (dr.inference.operators.MaximizerWrtParameterOperator)1 SimpleMCMCOperator (dr.inference.operators.SimpleMCMCOperator)1 TreeMaximizationOperator (dr.inference.operators.TreeMaximizationOperator)1 Transform (dr.util.Transform)1