Search in sources :

Example 1 with LoadingsGibbsOperator

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

the class LoadingsGibbsOperatorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String weightTemp = (String) xo.getAttribute(WEIGHT);
    double weight = Double.parseDouble(weightTemp);
    LatentFactorModel LFM = (LatentFactorModel) xo.getChild(LatentFactorModel.class);
    DistributionLikelihood prior = (DistributionLikelihood) xo.getChild(DistributionLikelihood.class);
    MomentDistributionModel prior2 = (MomentDistributionModel) xo.getChild(MomentDistributionModel.class);
    DistributionLikelihood cutoffPrior = null;
    if (xo.hasChildNamed(CUTOFF_PRIOR)) {
        cutoffPrior = (DistributionLikelihood) xo.getChild(CUTOFF_PRIOR).getChild(DistributionLikelihood.class);
    }
    boolean randomScan = xo.getAttribute(RANDOM_SCAN, true);
    int numThreads = xo.getAttribute(NUM_THREADS, 4);
    MatrixParameterInterface loadings = null;
    if (xo.getChild(MatrixParameterInterface.class) != null) {
        loadings = (MatrixParameterInterface) xo.getChild(MatrixParameterInterface.class);
    }
    DistributionLikelihood WorkingPrior = null;
    if (xo.getChild(WORKING_PRIOR) != null) {
        System.out.println("here");
        WorkingPrior = (DistributionLikelihood) xo.getChild(WORKING_PRIOR).getChild(DistributionLikelihood.class);
    }
    boolean multiThreaded = xo.getAttribute(MULTI_THREADED, false);
    if (prior != null)
        //To change body of implemented methods use File | Settings | File Templates.
        return new LoadingsGibbsOperator(LFM, prior, weight, randomScan, WorkingPrior, multiThreaded, numThreads);
    else
        return new LoadingsGibbsTruncatedOperator(LFM, prior2, weight, randomScan, loadings, cutoffPrior);
}
Also used : MatrixParameterInterface(dr.inference.model.MatrixParameterInterface) LatentFactorModel(dr.inference.model.LatentFactorModel) MomentDistributionModel(dr.inference.distribution.MomentDistributionModel) LoadingsGibbsOperator(dr.inference.operators.LoadingsGibbsOperator) DistributionLikelihood(dr.inference.distribution.DistributionLikelihood) LoadingsGibbsTruncatedOperator(dr.inference.operators.LoadingsGibbsTruncatedOperator)

Aggregations

DistributionLikelihood (dr.inference.distribution.DistributionLikelihood)1 MomentDistributionModel (dr.inference.distribution.MomentDistributionModel)1 LatentFactorModel (dr.inference.model.LatentFactorModel)1 MatrixParameterInterface (dr.inference.model.MatrixParameterInterface)1 LoadingsGibbsOperator (dr.inference.operators.LoadingsGibbsOperator)1 LoadingsGibbsTruncatedOperator (dr.inference.operators.LoadingsGibbsTruncatedOperator)1