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