Search in sources :

Example 1 with LoadingsSparsityOperator

use of dr.inference.operators.factorAnalysis.LoadingsSparsityOperator in project beast-mcmc by beast-dev.

the class LoadingsSparsityOperatorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    LoadingsGibbsTruncatedOperator operator = (LoadingsGibbsTruncatedOperator) xo.getChild(LoadingsGibbsTruncatedOperator.class);
    MatrixParameterInterface sparseness = (MatrixParameterInterface) xo.getChild(MatrixParameterInterface.class);
    double weight = xo.getDoubleAttribute(WEIGHT);
    return new LoadingsSparsityOperator(weight, operator, sparseness);
}
Also used : LoadingsSparsityOperator(dr.inference.operators.factorAnalysis.LoadingsSparsityOperator) MatrixParameterInterface(dr.inference.model.MatrixParameterInterface) LoadingsGibbsTruncatedOperator(dr.inference.operators.factorAnalysis.LoadingsGibbsTruncatedOperator)

Example 2 with LoadingsSparsityOperator

use of dr.inference.operators.factorAnalysis.LoadingsSparsityOperator 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
    SimpleMCMCOperator sparsityOperator = null;
    if (xo.getChild(BitFlipOperator.class) != null)
        sparsityOperator = (BitFlipOperator) xo.getChild(BitFlipOperator.class);
    if (xo.getChild(LoadingsSparsityOperator.class) != null) {
        sparsityOperator = (LoadingsSparsityOperator) xo.getChild(LoadingsSparsityOperator.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);
    LatentFactorModelPrecisionGibbsOperator precisionGibbsOperator = null;
    if (xo.getChild(LatentFactorModelPrecisionGibbsOperator.class) != null) {
        System.out.println("here");
        precisionGibbsOperator = (LatentFactorModelPrecisionGibbsOperator) xo.getChild(LatentFactorModelPrecisionGibbsOperator.class);
    }
    return new FactorRJMCMCOperator(weight, sizeParameter, chainLength, factors, loadings, cutoffs, loadingsSparcity, LFM, DPP, loadingsPrior, loadingsOperator, factorOperator, sparsityOperator, NOp, rowPrior, precisionGibbsOperator);
}
Also used : LoadingsSparsityOperator(dr.inference.operators.factorAnalysis.LoadingsSparsityOperator) AdaptableSizeFastMatrixParameter(dr.inference.model.AdaptableSizeFastMatrixParameter) Likelihood(dr.inference.model.Likelihood) AbstractModelLikelihood(dr.inference.model.AbstractModelLikelihood) FactorRJMCMCOperator(dr.inference.operators.factorAnalysis.FactorRJMCMCOperator) LatentFactorModelPrecisionGibbsOperator(dr.inference.operators.factorAnalysis.LatentFactorModelPrecisionGibbsOperator) AbstractModelLikelihood(dr.inference.model.AbstractModelLikelihood) DeterminentalPointProcessPrior(dr.inference.distribution.DeterminentalPointProcessPrior) FactorTreeGibbsOperator(dr.inference.operators.factorAnalysis.FactorTreeGibbsOperator) RowDimensionPoissonPrior(dr.inference.distribution.RowDimensionPoissonPrior)

Aggregations

LoadingsSparsityOperator (dr.inference.operators.factorAnalysis.LoadingsSparsityOperator)2 DeterminentalPointProcessPrior (dr.inference.distribution.DeterminentalPointProcessPrior)1 RowDimensionPoissonPrior (dr.inference.distribution.RowDimensionPoissonPrior)1 AbstractModelLikelihood (dr.inference.model.AbstractModelLikelihood)1 AdaptableSizeFastMatrixParameter (dr.inference.model.AdaptableSizeFastMatrixParameter)1 Likelihood (dr.inference.model.Likelihood)1 MatrixParameterInterface (dr.inference.model.MatrixParameterInterface)1 FactorRJMCMCOperator (dr.inference.operators.factorAnalysis.FactorRJMCMCOperator)1 FactorTreeGibbsOperator (dr.inference.operators.factorAnalysis.FactorTreeGibbsOperator)1 LatentFactorModelPrecisionGibbsOperator (dr.inference.operators.factorAnalysis.LatentFactorModelPrecisionGibbsOperator)1 LoadingsGibbsTruncatedOperator (dr.inference.operators.factorAnalysis.LoadingsGibbsTruncatedOperator)1