当前位置: 首页>>代码示例>>Java>>正文


Java DistributionLikelihood.getDistribution方法代码示例

本文整理汇总了Java中dr.inference.distribution.DistributionLikelihood.getDistribution方法的典型用法代码示例。如果您正苦于以下问题:Java DistributionLikelihood.getDistribution方法的具体用法?Java DistributionLikelihood.getDistribution怎么用?Java DistributionLikelihood.getDistribution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dr.inference.distribution.DistributionLikelihood的用法示例。


在下文中一共展示了DistributionLikelihood.getDistribution方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {

            double weight = xo.getDoubleAttribute(WEIGHT);

            DistributionLikelihood likelihood = (DistributionLikelihood) ((XMLObject) xo.getChild(LIKELIHOOD)).getChild(DistributionLikelihood.class);
            DistributionLikelihood prior = (DistributionLikelihood) ((XMLObject) xo.getChild(PRIOR)).getChild(DistributionLikelihood.class);

//            System.err.println("class: " + prior.getDistribution().getClass());

            if (!((prior.getDistribution() instanceof GammaDistribution) ||
                    (prior.getDistribution() instanceof GammaDistributionModel)
            ) ||
                    !((likelihood.getDistribution() instanceof NormalDistributionModel) ||
                            (likelihood.getDistribution() instanceof LogNormalDistributionModel)
                    ))
                throw new XMLParseException("Gibbs operator assumes normal-gamma model");

            return new NormalGammaPrecisionGibbsOperator(likelihood, prior.getDistribution(), weight);
        }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:20,代码来源:NormalGammaPrecisionGibbsOperator.java

示例2: NormalNormalMeanGibbsOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public NormalNormalMeanGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                     double weight) {

    if (!(prior instanceof NormalDistribution || prior instanceof NormalDistributionModel))
        throw new RuntimeException("Mean prior must be Normal");

    this.likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel)
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    else if (likelihood instanceof LogNormalDistributionModel) {
        if (((LogNormalDistributionModel) likelihood).getParameterization() == LogNormalDistributionModel.Parameterization.MEAN_STDEV) {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        } else {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMuParameter();
        }
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:24,代码来源:NormalNormalMeanGibbsOperator.java

示例3: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {

            double weight = xo.getDoubleAttribute(WEIGHT);

            DistributionLikelihood likelihood = (DistributionLikelihood) ((XMLObject) xo.getChild(LIKELIHOOD)).getChild(DistributionLikelihood.class);
            DistributionLikelihood prior = (DistributionLikelihood) ((XMLObject) xo.getChild(PRIOR)).getChild(DistributionLikelihood.class);

//            System.err.println("class: " + prior.getDistribution().getClass());

            if (!((prior.getDistribution() instanceof NormalDistribution) ||
                    (prior.getDistribution() instanceof NormalDistributionModel)
            ) ||
                    !((likelihood.getDistribution() instanceof NormalDistributionModel) ||
                            (likelihood.getDistribution() instanceof LogNormalDistributionModel)
                    ))
                throw new XMLParseException("Gibbs operator assumes normal-normal model");

            return new NormalNormalMeanGibbsOperator(likelihood, prior.getDistribution(), weight);
        }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:20,代码来源:NormalNormalMeanGibbsOperator.java

示例4: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    DistributionLikelihood priorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PRIOR);
    DistributionLikelihood pseudoPriorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PSEUDO_PRIOR);
    Distribution prior = priorLikelihood.getDistribution();
    Distribution pseudoPrior = pseudoPriorLikelihood.getDistribution();
    Parameter modelIndicator = (Parameter)xo.getElementFirstChild(MODEL_INDICATOR);
    int[] models = xo.getIntegerArrayAttribute(MODELS);
    Parameter selectedVariable = (Parameter)xo.getElementFirstChild(SELECTED_VARIABLE);


    ModelSpecificPseudoPriorLikelihood likelihood =
            new ModelSpecificPseudoPriorLikelihood(
                    prior,
                    pseudoPrior,
                    modelIndicator,
                    models
            );
    likelihood.addData(selectedVariable);
    

    return likelihood;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:23,代码来源:ModelSpecificPseudoPriorLikelihoodParser.java

示例5: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    DistributionLikelihood priorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PRIOR);
    DistributionLikelihood pseudoPriorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PSEUDO_PRIOR);
    Distribution prior = priorLikelihood.getDistribution();
    Distribution pseudoPrior = pseudoPriorLikelihood.getDistribution();
    Parameter bitVector = (Parameter)xo.getElementFirstChild(PARAMETER_VECTOR);
    int paramIndex = xo.getIntegerAttribute(PARAMETER_INDEX);
    Parameter selectedVariable = (Parameter)xo.getElementFirstChild(SELECTED_VARIABLE);


    TwoPartsDistributionLikelihood likelihood =
            new TwoPartsDistributionLikelihood(
                    prior,
                    pseudoPrior,
                    bitVector,
                    paramIndex
            );
    likelihood.addData(selectedVariable);

    return likelihood;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:22,代码来源:TwoPartsDistributionLikelihoodParser.java

示例6: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {

    Object obj = xo.getChild(0);

    if (obj instanceof MultivariateDistributionLikelihood) {
        final MultivariateDistributionLikelihood mdl = (MultivariateDistributionLikelihood)
                xo.getChild(MultivariateDistributionLikelihood.class);

        if (!(mdl.getDistribution() instanceof GradientProvider)) {
            throw new XMLParseException("Not a gradient provider");
        }

        final GradientProvider provider = (GradientProvider) mdl.getDistribution();
        final Parameter parameter = mdl.getDataParameter();

        return new GradientWrtParameterProvider.ParameterWrapper(provider, parameter, mdl);
    } else {
        DistributionLikelihood dl = (DistributionLikelihood) obj;
        if (!(dl.getDistribution() instanceof GradientProvider)) {
            throw new XMLParseException("Not a gradient provider");
        }

        throw new RuntimeException("Not yet implemented");
    }
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:27,代码来源:GradientWrapperParser.java

示例7: NormalGammaPrecisionGibbsOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public NormalGammaPrecisionGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                         double weight) {

    if (!(prior instanceof GammaDistribution || prior instanceof GammaDistributionModel))
        throw new RuntimeException("Precision prior must be Gamma");

    Distribution likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel) {
        this.precisionParameter = (Parameter) ((NormalDistributionModel) likelihood).getPrecision();
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    } else if (likelihood instanceof LogNormalDistributionModel) {
        this.precisionParameter = ((LogNormalDistributionModel) likelihood).getPrecisionParameter();
        this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    if (precisionParameter == null)
        throw new RuntimeException("Must characterize likelihood in terms of a precision parameter");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:whdc,项目名称:ieo-beast,代码行数:25,代码来源:NormalGammaPrecisionGibbsOperator.java

示例8: NormalNormalMeanGibbsOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public NormalNormalMeanGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                     double weight) {

    if (!(prior instanceof NormalDistribution || prior instanceof NormalDistributionModel))
        throw new RuntimeException("Mean prior must be Normal");

    this.likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel)
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    else if (likelihood instanceof LogNormalDistributionModel) {
        this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:whdc,项目名称:ieo-beast,代码行数:20,代码来源:NormalNormalMeanGibbsOperator.java

示例9: TruncatedDistributionLikelihood

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public TruncatedDistributionLikelihood(DistributionLikelihood distribution, Parameter low, Parameter high){
        super(distribution.getDistribution());
        this.dataList = (ArrayList<Attribute<double[]>>) distribution.getDataList();
//        for(Attribute<double[]> data : list){
//            System.out.println("here");
//            this.addData(data);
//        }
        this.low = low;
        this.high = high;
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:11,代码来源:TruncatedDistributionLikelihood.java

示例10: NormalGammaPrecisionGibbsOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public NormalGammaPrecisionGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                         double weight) {

    if (!(prior instanceof GammaDistribution || prior instanceof GammaDistributionModel))
        throw new RuntimeException("Precision prior must be Gamma");

    Distribution likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();

    if (likelihood instanceof NormalDistributionModel) {
        this.precisionParameter = (Parameter) ((NormalDistributionModel) likelihood).getPrecision();
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    } else if (likelihood instanceof LogNormalDistributionModel) {
        if (((LogNormalDistributionModel) likelihood).getParameterization() == LogNormalDistributionModel.Parameterization.MU_PRECISION) {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMuParameter();
        } else {
            throw new RuntimeException("Must characterize likelihood in terms of mu and precision parameters");
        }
        this.precisionParameter = ((LogNormalDistributionModel) likelihood).getPrecisionParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    if (precisionParameter == null)
        throw new RuntimeException("Must characterize likelihood in terms of a precision parameter");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:30,代码来源:NormalGammaPrecisionGibbsOperator.java

示例11: LatentFactorModelPrecisionGibbsOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public LatentFactorModelPrecisionGibbsOperator(LatentFactorModel LFM, DistributionLikelihood prior, double weight, boolean randomScan) {
        setWeight(weight);
        this.LFM = LFM;
        this.prior = (GammaDistribution) prior.getDistribution();
        this.randomScan = randomScan;
        this.missingIndicator = LFM.getMissingIndicator();

//        FacXLoad=new double[LFM.getFactors().getColumnDimension()];
//        residual=new double[LFM.getFactors().getColumnDimension()];
//        setShape();
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:12,代码来源:LatentFactorModelPrecisionGibbsOperator.java

示例12: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {

            double weight = xo.getDoubleAttribute(WEIGHT);
            AbstractMultivariateTraitLikelihood traitLikelihood =
                    (AbstractMultivariateTraitLikelihood) xo.getChild(AbstractMultivariateTraitLikelihood.class);
            ArbitraryBranchRates branchRates = (ArbitraryBranchRates) xo.getChild(ArbitraryBranchRates.class);

            DistributionLikelihood priorLikelihood = (DistributionLikelihood) xo.getChild(DistributionLikelihood.class);

            GammaDistributionModel gammaPriorModel = null;
            GammaDistribution gammaPrior = null;

            if (priorLikelihood.getDistribution() instanceof GammaDistributionModel) {
                gammaPriorModel = (GammaDistributionModel) priorLikelihood.getDistribution();
            } else if (priorLikelihood.getDistribution() instanceof GammaDistribution) {
                gammaPrior = (GammaDistribution) priorLikelihood.getDistribution();
            } else {
                throw new XMLParseException("Currently only works with a GammaDistributionModel or GammaDistribution");
            }

            if (!branchRates.usingReciprocal()) {
                throw new XMLParseException(
                        "Gibbs sampling of rates only works with reciprocal rates under an ArbitraryBranchRates model");
            }

            TraitRateGibbsOperator operator = new TraitRateGibbsOperator(traitLikelihood, branchRates, gammaPriorModel, gammaPrior);
            operator.setWeight(weight);

            return operator;
        }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:31,代码来源:TraitRateGibbsOperator.java

示例13: LoadingsIndependenceOperator

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
public LoadingsIndependenceOperator(LatentFactorModel LFM, DistributionLikelihood prior, double weight, boolean randomScan, double scaleFactor, CoercionMode mode) {
        super(mode);
        setWeight(weight);

        this.scaleFactor = scaleFactor;
        this.prior = (NormalDistribution) prior.getDistribution();
        this.LFM = LFM;
        precisionArray = new ArrayList<double[][]>();
        double[][] temp;
        this.randomScan = randomScan;


        meanArray = new ArrayList<double[]>();
        meanMidArray = new ArrayList<double[]>();
        double[] tempMean;
        if (!randomScan) {
            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                temp = new double[i + 1][i + 1];
                precisionArray.add(temp);
            }
            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                tempMean = new double[i + 1];
                meanArray.add(tempMean);
            }

            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                tempMean = new double[i + 1];
                meanMidArray.add(tempMean);
            }
        } else {
            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                temp = new double[LFM.getFactorDimension() - i][LFM.getFactorDimension() - i];
                precisionArray.add(temp);
            }
            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                tempMean = new double[LFM.getFactorDimension() - i];
                meanArray.add(tempMean);
            }

            for (int i = 0; i < LFM.getFactorDimension(); i++) {
                tempMean = new double[LFM.getFactorDimension() - i];
                meanMidArray.add(tempMean);
            }
        }

//            vectorProductAnswer=new MatrixParameter[LFM.getLoadings().getRowDimension()];
//            for (int i = 0; i <vectorProductAnswer.length ; i++) {
//                vectorProductAnswer[i]=new MatrixParameter(null);
//                vectorProductAnswer[i].setDimensions(i+1, 1);
//            }

//        priorMeanVector=new MatrixParameter[LFM.getLoadings().getRowDimension()];
//            for (int i = 0; i <priorMeanVector.length ; i++) {
//                priorMeanVector[i]=new MatrixParameter(null, i+1, 1, this.prior.getMean()/(this.prior.getSD()*this.prior.getSD()));
//
//
//            }
        priorPrecision = 1 / (this.prior.getSD() * this.prior.getSD());
        priorMeanPrecision = this.prior.getMean() * priorPrecision;
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:61,代码来源:LoadingsIndependenceOperator.java

示例14: parseXMLObject

import dr.inference.distribution.DistributionLikelihood; //导入方法依赖的package包/类
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {

    List<GradientWrtParameterProvider> gradList = new ArrayList<GradientWrtParameterProvider>();
    List<Likelihood> likelihoodList = new ArrayList<Likelihood>(); // TODO Remove?

    for (int i = 0; i < xo.getChildCount(); ++i) {

        Object obj = xo.getChild(i);

        GradientWrtParameterProvider grad;
        Likelihood likelihood;

        if (obj instanceof DistributionLikelihood) {
            DistributionLikelihood dl = (DistributionLikelihood) obj;
            if (!(dl.getDistribution() instanceof GradientProvider)) {
                throw new XMLParseException("Not a gradient provider");
            }

            throw new RuntimeException("Not yet implemented");

        } else if (obj instanceof MultivariateDistributionLikelihood) {
            final MultivariateDistributionLikelihood mdl = (MultivariateDistributionLikelihood) obj;
            if (!(mdl.getDistribution() instanceof GradientProvider)) {
                throw new XMLParseException("Not a gradient provider");
            }

            final GradientProvider provider = (GradientProvider) mdl.getDistribution();
            final Parameter parameter = mdl.getDataParameter();
            likelihood = mdl;

            grad = new GradientWrtParameterProvider.ParameterWrapper(provider, parameter, mdl);

        } else if (obj instanceof GradientWrtParameterProvider) {
            grad = (GradientWrtParameterProvider) obj;
            likelihood = grad.getLikelihood();
        } else {
            throw new XMLParseException("Not a Gaussian process");
        }

        gradList.add(grad);
        likelihoodList.add(likelihood);
    }

    return new CompoundGradient(gradList);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:47,代码来源:AppendedPotentialDerivativeParser.java


注:本文中的dr.inference.distribution.DistributionLikelihood.getDistribution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。