• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Probability类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cern.jet.stat.Probability的典型用法代码示例。如果您正苦于以下问题:Java Probability类的具体用法?Java Probability怎么用?Java Probability使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Probability类属于cern.jet.stat包,在下文中一共展示了Probability类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: computeMissingParameterAfterSim

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public void computeMissingParameterAfterSim()
{
	// Only compute for numSamples > 1
	// (Student's t-distribution only defined for v > 0)
	if (numSamples > 1) {
		double prob, x;
		x = width * Math.sqrt(numSamples / varEstimator);
		// Note: need to hard-code case x=Inf
		if (Double.isInfinite(x)) {
			prob = 1.0;
		}
		// (Note: Colt's studentT seems to break for v=1 so do manually)
		else if (numSamples - 1 > 1) {
			prob = Probability.studentT(x, numSamples - 1);
		} else {
			// PDF for v=1 is 1/2 + arctan(x)/pi
			prob = 0.5 + Math.atan(x) / Math.PI;
		}
		confidence = 2 * (1.0 - prob);
		missingParameterComputed = true;
	}
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:24,代码来源:CIconfidence.java


示例2: computeMissingParameterAfterSim

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public void computeMissingParameterAfterSim()
{
	double quantile;
	// Only compute for numSamples > 1
	// (Student's t-distribution only defined for v > 0)
	if (numSamples > 1) {
		// (Note: Colt's studentTinverse seems to break for v=1 so do manually)
		if (numSamples - 1 > 1) {
			quantile = Probability.studentTInverse(confidence, numSamples - 1);
		} else {
			// PDF for v=1 is 1/2 + arctan(x)/pi
			// Want x for pdf = 1-conf/2 
			quantile = Math.tan((0.5 - confidence / 2) * Math.PI);
		}
		width = quantile * Math.sqrt(varEstimator / numSamples);
		missingParameterComputed = true;
	}
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:20,代码来源:CIwidth.java


示例3: binomialSampleEquality

import cern.jet.stat.Probability; //导入依赖的package包/类
protected double binomialSampleEquality(double X1, double X2, double n1, double n2){
	double P1 = X1/n1;
	double P2 = X2/n2;
	double P = (X1+X2)/(n1+n2);
	double Z = (P1-P2)/(Math.sqrt(P*(1-P)*((1/n1)+(1/n2))));
	if(!Double.isNaN(Z))
		return(1-Probability.normal(Z));
	else
		return(-1);
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:11,代码来源:MotifAnalysisMultiMotif.java


示例4: shouldStopNow

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public boolean shouldStopNow(int iters, Sampler sampler)
{
	double quantile = 0.0;

	// Need at least 2 iterations
	// (Student's t-distribution only defined for v > 1)
	// (and variance is always 0 for iters = 1)
	if (iters < 2)
		return false;

	// We cannot conclude yet whether it is a "S^2=0" case or if the estimator is still valid (i.e. std error > 0)
	if (sampler.getVariance() <= 0.0) {
		// automatic
		if (!reqIterToConcludeGiven && maxReward / width > iters)
			return false;
		// "manual"
		if (reqIterToConcludeGiven && reqIterToConclude > iters)
			return false;
	}

	// The required number of iterations for the expected confidence is not reached yet
	quantile = Probability.normalInverse(1.0 - confidence / 2.0);
	squaredQuantile = quantile * quantile;
	if (sampler.getVariance() > 0.0 && (iters + 1) < sampler.getVariance() * squaredQuantile / (width * width))
		return false;

	// Store final number of iterations (to compute missing parameter later)
	computedIterations = iters;
	return true;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:32,代码来源:ACIiterations.java


示例5: shouldStopNow

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public boolean shouldStopNow(int iters, Sampler sampler)
{
	double quantile = 0.0;

	// Need at least 2 iterations
	// (Student's t-distribution only defined for v > 0)
	// (and variance is always 0 for iters = 1)
	if (iters < 2)
		return false;

	// We cannot conclude yet whether it is a "S^2=0" case or if the estimator is still valid (i.e. std error > 0)
	if (sampler.getVariance() <= 0.0) {
		// automatic
		if (!reqIterToConcludeGiven && maxReward / width > iters)
			return false;
		// "manual"
		if (reqIterToConcludeGiven && reqIterToConclude > iters)
			return false;
	}

	// See if required number of iterations for the expected confidence is reached yet
	// (Note: Colt's studentTinverse seems to break for v=1 so do manually)
	if (iters - 1 > 1) {
		quantile = Probability.studentTInverse(confidence, iters - 1);
	} else {
		// PDF for v=1 is 1/2 + arctan(x)/pi
		// Want x for pdf = 1-conf/2 
		quantile = Math.tan((0.5 - confidence / 2) * Math.PI);
	}
	squaredQuantile = quantile * quantile;
	if (sampler.getVariance() > 0.0 && iters < sampler.getVariance() * squaredQuantile / (width * width))
		return false;

	// Store final number of iterations (to compute missing parameter later)
	computedIterations = iters;
	return true;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:39,代码来源:CIiterations.java


示例6: getInverseCDF

import cern.jet.stat.Probability; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public double getInverseCDF(final Double p) {
  Validate.notNull(p);
  Validate.isTrue(p >= 0 && p <= 1, "Probability must be >= 0 and <= 1");
  return Probability.normalInverse(p);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:10,代码来源:NormalDistribution.java


示例7: pValueForTstat

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double pValueForTstat(double tstat, int df)
        throws ExtensionException {
  // Returns the P value of the T statistic tstat with df degrees of
  // freedom. This is a two-tailed test so we just double the right
  // tail which is given by studentT of -|tstat|.

  double x = Math.abs(tstat);
  try {
    double p = Probability.studentT((double) df, -x);
    return 2.0 * p;
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .studentT reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:15,代码来源:Distributions.java


示例8: getStudentArea

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getStudentArea(double x, int df)
        throws ExtensionException {
  // Returns the area to the left of x in the Student T distribution
  // with the given degrees of freedom.
  try {
    return Probability.studentT((double) df, x);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .studentT reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:11,代码来源:Distributions.java


示例9: getNormalArea

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getNormalArea(double x, double mean, double sd)
        throws ExtensionException {
  // Returns the area to the left of x in the normal distribution
  // with the given mean and standard deviation.
  try {
    return Probability.normal(mean, sd, x);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .normal reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:11,代码来源:Distributions.java


示例10: getStudentTInverse

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getStudentTInverse(double x, int df)
        throws ExtensionException {
  // Returns the value, t, for which the area under the Student-t 
  // probability density function (integrated from minus infinity to t) 
  // is equal to x.
  double a = 2.0 * (1.0 - x);
  try {
    return Probability.studentTInverse(a, df);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .studentTInverse reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:13,代码来源:Distributions.java


示例11: getNormalInverse

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getNormalInverse(double area, double mean, double sd)
        throws ExtensionException {
  // Returns the x in the normal distribution with the given mean and
  // standard deviation, to the left of which lies the given area.
  // normal.Inverse returns the value in terms of standard deviations
  // from the mean, so we need to adjust it for the given mean and 
  // standard deviation.
  try {
    double x = Probability.normalInverse(area);
    return (x + mean) * sd;
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .normalInverse reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:15,代码来源:Distributions.java


示例12: getBinomialComplemented

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getBinomialComplemented(int n, int k, double p)
        throws ExtensionException {
  // Returns the sum of the terms k+1 through n of the Binomial 
  // probability density, where n is the number of trials and P is
  // the probability of success in the range 0 to 1.
  try {
    return Probability.binomialComplemented(k, n, p);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .binomialComplement reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:12,代码来源:Distributions.java


示例13: getChiSquare

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getChiSquare(double x, double df)
        throws ExtensionException {
  // Returns the area under the left hand tail (from 0 to x) of the 
  // Chi square probability density function with df degrees of freedom.
  try {
    return Probability.chiSquare(df, x);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .chiSquare reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:11,代码来源:Distributions.java


示例14: getChiSquareComplemented

import cern.jet.stat.Probability; //导入依赖的package包/类
public static double getChiSquareComplemented(double x, double df)
        throws ExtensionException {
  // Returns the area under the right hand tail (from x to infinity) 
  // of the Chi square probability density function with df degrees 
  // of freedom.
  try {
    return Probability.chiSquareComplemented(df, x);
  } catch (IllegalArgumentException | ArithmeticException ex) {
    throw new ExtensionException("colt .chiSquareComplemented reports: " + ex);
  }
}
 
开发者ID:cstaelin,项目名称:Stats-Extension,代码行数:12,代码来源:Distributions.java


示例15: binomialSampleEquality

import cern.jet.stat.Probability; //导入依赖的package包/类
protected double binomialSampleEquality(double X1, double X2, double n1, double n2){
    double P1 = X1/n1;
    double P2 = X2/n2;
    double P = (X1+X2)/(n1+n2);
    double Z = (P1-P2)/(Math.sqrt(P*(1-P)*((1/n1)+(1/n2))));
    if(!Double.isNaN(Z)){
	double prob = Probability.normal(Z);
	if(prob>0.5)
	    return(1-prob);
	else
	    return(prob);
    }else{
	return(-1);
    }
}
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:16,代码来源:RegionEnrichment.java


示例16: getPValueForChi_Squrare

import cern.jet.stat.Probability; //导入依赖的package包/类
public double getPValueForChi_Squrare() {
    return Probability.chiSquareComplemented(getD_FValue(), getChi_SquareValue());
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:4,代码来源:SignificanceTestForTwoDatasets.java


示例17: getPValueForProportionTest

import cern.jet.stat.Probability; //导入依赖的package包/类
public double getPValueForProportionTest() {
    return Probability.chiSquareComplemented(1.0, getChi_SquareValueWithContinuityCorrectionTwoTailed());
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:4,代码来源:SignificanceTestForTwoDatasets.java


示例18: computeMissingParameterAfterSim

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public void computeMissingParameterAfterSim()
{
	width = Probability.normalInverse(1.0 - confidence / 2.0) * Math.sqrt(varEstimator / numSamples);
	missingParameterComputed = true;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:7,代码来源:ACIwidth.java


示例19: computeMissingParameterAfterSim

import cern.jet.stat.Probability; //导入依赖的package包/类
@Override
public void computeMissingParameterAfterSim()
{
	confidence = 2 * (1.0 - Probability.normal(width * Math.sqrt(numSamples / varEstimator)));
	missingParameterComputed = true;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:7,代码来源:ACIconfidence.java


示例20: computeQuantitativeEnrichment

import cern.jet.stat.Probability; //导入依赖的package包/类
static void computeQuantitativeEnrichment(NetworkProvider networkProvider,
                                          AnnotationProvider annotationProvider,
                                          NeighborhoodScoringMethod scoringMethod,
                                          ProgressReporter progressReporter,
                                          List<? extends Neighborhood> neighborhoods) {

    Stream<? extends Neighborhood> stream = neighborhoods.stream();
    if (progressReporter.supportsParallel()) {
        stream = stream.parallel();
    }
    progressReporter.startNeighborhoodScore(networkProvider, annotationProvider);
    stream.forEach(neighborhood -> {
        int nodeIndex = neighborhood.getNodeIndex();
        for (int j = 0; j < annotationProvider.getAttributeCount(); j++) {
            final int attributeIndex = j;
            double[] neighborhoodScore = { 0 };

            neighborhood.forEachMemberIndex(index -> {
                double value = annotationProvider.getValue(index, attributeIndex);
                if (!Double.isNaN(value)) {
                    neighborhoodScore[0] += value;
                }
            });

            double[] randomScores = scoringMethod.computeRandomizedScores(neighborhood, j);
            SummaryStatistics statistics = new SummaryStatistics();
            for (int r = 0; r < randomScores.length; r++) {
                if (!Double.isNaN(randomScores[r])) {
                    statistics.addValue(randomScores[r]);
                }
            }

            double p = 1 - Probability.normal(statistics.getMean(), statistics.getVariance(), neighborhoodScore[0]);

            neighborhood.setPValue(j, p);

            double score = Neighborhood.computeEnrichmentScore(p);
            progressReporter.neighborhoodScore(nodeIndex, j, score);
        }
        progressReporter.finishNeighborhood(nodeIndex);
    });
    progressReporter.finishNeighborhoodScore();
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:44,代码来源:ParallelSafe.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocateRequestMessage类代码示例发布时间:2022-05-22
下一篇:
Java CodeBaseHelper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap