Search in sources :

Example 1 with AdaptableSizeFastMatrixParameter

use of dr.inference.model.AdaptableSizeFastMatrixParameter in project beast-mcmc by beast-dev.

the class FactorRJMCMCOperatorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    //attributes
    double weight = xo.getDoubleAttribute(WEIGHT);
    int chainLength = xo.getIntegerAttribute(CHAIN_LENGTH);
    double sizeParameter = xo.getDoubleAttribute(SIZE_PARAMETER);
    //declaration
    AdaptableSizeFastMatrixParameter factors, loadings, cutoffs, loadingsSparcity;
    //parameters
    if (xo.hasChildNamed(FACTORS))
        factors = (AdaptableSizeFastMatrixParameter) xo.getChild(FACTORS).getChild(AdaptableSizeFastMatrixParameter.class);
    else
        factors = null;
    loadings = (AdaptableSizeFastMatrixParameter) xo.getChild(LOADINGS).getChild(AdaptableSizeFastMatrixParameter.class);
    if (xo.hasChildNamed(CUTOFFS)) {
        cutoffs = (AdaptableSizeFastMatrixParameter) xo.getChild(CUTOFFS).getChild(AdaptableSizeFastMatrixParameter.class);
    } else
        cutoffs = null;
    if (xo.hasChildNamed(LOADINGS_SPARSITY))
        loadingsSparcity = (AdaptableSizeFastMatrixParameter) xo.getChild(LOADINGS_SPARSITY).getChild(AdaptableSizeFastMatrixParameter.class);
    else
        loadingsSparcity = null;
    //models
    DeterminentalPointProcessPrior DPP = null;
    if (xo.getChild(SPARSITY_PRIOR) != null)
        DPP = (DeterminentalPointProcessPrior) xo.getChild(SPARSITY_PRIOR).getChild(DeterminentalPointProcessPrior.class);
    SimpleMCMCOperator NOp = null;
    if (xo.getChild(NEGATION_OPERATOR) != null) {
        NOp = (SimpleMCMCOperator) xo.getChild(NEGATION_OPERATOR).getChild(SimpleMCMCOperator.class);
    }
    AbstractModelLikelihood LFM = (AbstractModelLikelihood) xo.getChild(AbstractModelLikelihood.class);
    RowDimensionPoissonPrior rowPrior = (RowDimensionPoissonPrior) xo.getChild(ROW_PRIOR).getChild(RowDimensionPoissonPrior.class);
    Likelihood loadingsPrior = null;
    if (xo.hasChildNamed(LOADINGS_PRIOR)) {
        loadingsPrior = (Likelihood) xo.getChild(LOADINGS_PRIOR).getChild(Likelihood.class);
    }
    //operators
    BitFlipOperator sparsityOperator = null;
    if (xo.getChild(BitFlipOperator.class) != null)
        sparsityOperator = (BitFlipOperator) xo.getChild(BitFlipOperator.class);
    SimpleMCMCOperator loadingsOperator = (SimpleMCMCOperator) xo.getChild(LOADINGS_OPERATOR).getChild(SimpleMCMCOperator.class);
    SimpleMCMCOperator factorOperator = null;
    if (xo.getChild(FACTOR_OPERATOR) != null)
        factorOperator = (SimpleMCMCOperator) xo.getChild(FACTOR_OPERATOR).getChild(FactorTreeGibbsOperator.class);
    return new FactorRJMCMCOperator(weight, sizeParameter, chainLength, factors, loadings, cutoffs, loadingsSparcity, LFM, DPP, loadingsPrior, loadingsOperator, factorOperator, sparsityOperator, NOp, rowPrior);
}
Also used : AdaptableSizeFastMatrixParameter(dr.inference.model.AdaptableSizeFastMatrixParameter) AbstractModelLikelihood(dr.inference.model.AbstractModelLikelihood) DeterminentalPointProcessPrior(dr.inference.distribution.DeterminentalPointProcessPrior) Likelihood(dr.inference.model.Likelihood) AbstractModelLikelihood(dr.inference.model.AbstractModelLikelihood) RowDimensionPoissonPrior(dr.inference.distribution.RowDimensionPoissonPrior)

Example 2 with AdaptableSizeFastMatrixParameter

use of dr.inference.model.AdaptableSizeFastMatrixParameter in project beast-mcmc by beast-dev.

the class RowDimensionPoissonPriorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    AdaptableSizeFastMatrixParameter parameter = (AdaptableSizeFastMatrixParameter) xo.getChild(AdaptableSizeFastMatrixParameter.class);
    double untruncatedMean = xo.getDoubleAttribute(UNTRUNCATED_MEAN);
    boolean transpose = false;
    if (xo.hasAttribute(TRANSPOSE))
        transpose = xo.getBooleanAttribute(TRANSPOSE);
    return new RowDimensionPoissonPrior(untruncatedMean, parameter, transpose);
}
Also used : AdaptableSizeFastMatrixParameter(dr.inference.model.AdaptableSizeFastMatrixParameter) RowDimensionPoissonPrior(dr.inference.distribution.RowDimensionPoissonPrior)

Example 3 with AdaptableSizeFastMatrixParameter

use of dr.inference.model.AdaptableSizeFastMatrixParameter in project beast-mcmc by beast-dev.

the class IndianBuffetProcessPriorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Parameter alpha = (Parameter) xo.getChild(ALPHA).getChild(0);
    AdaptableSizeFastMatrixParameter data = (AdaptableSizeFastMatrixParameter) xo.getChild(DATA).getChild(0);
    Parameter beta;
    if (xo.hasChildNamed(BETA)) {
        beta = (Parameter) xo.getChild(BETA).getChild(0);
    } else {
        beta = new Parameter.Default(1);
    }
    return new IndianBuffetProcessPrior(alpha, beta, data);
}
Also used : IndianBuffetProcessPrior(dr.inference.model.IndianBuffetProcessPrior) AdaptableSizeFastMatrixParameter(dr.inference.model.AdaptableSizeFastMatrixParameter) Parameter(dr.inference.model.Parameter) AdaptableSizeFastMatrixParameter(dr.inference.model.AdaptableSizeFastMatrixParameter) MatrixParameter(dr.inference.model.MatrixParameter)

Aggregations

AdaptableSizeFastMatrixParameter (dr.inference.model.AdaptableSizeFastMatrixParameter)3 RowDimensionPoissonPrior (dr.inference.distribution.RowDimensionPoissonPrior)2 DeterminentalPointProcessPrior (dr.inference.distribution.DeterminentalPointProcessPrior)1 AbstractModelLikelihood (dr.inference.model.AbstractModelLikelihood)1 IndianBuffetProcessPrior (dr.inference.model.IndianBuffetProcessPrior)1 Likelihood (dr.inference.model.Likelihood)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Parameter (dr.inference.model.Parameter)1