本文整理汇总了Java中org.apache.commons.math3.special.Beta类的典型用法代码示例。如果您正苦于以下问题:Java Beta类的具体用法?Java Beta怎么用?Java Beta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Beta类属于org.apache.commons.math3.special包,在下文中一共展示了Beta类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
double ret;
if (x == 0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
degreesOfFreedom / (degreesOfFreedom + (x * x)),
0.5 * degreesOfFreedom,
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:biocompibens,项目名称:SME,代码行数:21,代码来源:TDistribution.java
示例2: initialMinorFractions
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/**
* Initialize minor fractions assuming no allelic bias <p></p>
*
* We integrate over f to get posterior probabilities (responsibilities) of alt / ref minor
* that is, responsibility of alt minor is int_{0 to 1/2} f^a (1-f)^r df
* responsibility of ref minor is int_{0 to 1/2} f^r (1-f)^a df
* these are proportional to I(1/2, a + 1, r + 1) and I(1/2, r + 1, a + 1),
* respectively, where I is the (incomplete) regularized Beta function.
* By definition these likelihoods sum to 1, ie they are already normalized. <p></p>
*
* Finally, we set each minor fraction to the responsibility-weighted total count of
* reads in minor allele divided by total reads, ignoring outliers.
*/
private AlleleFractionState.MinorFractions initialMinorFractions(final AlleleFractionData data) {
final int numSegments = data.getNumSegments();
final AlleleFractionState.MinorFractions result = new AlleleFractionState.MinorFractions(numSegments);
for (int segment = 0; segment < numSegments; segment++) {
double responsibilityWeightedMinorAlleleReadCount = 0.0;
double responsibilityWeightedTotalReadCount = 0.0;
for (final AllelicCount count : data.getCountsInSegment(segment)) {
final int a = count.getAltReadCount();
final int r = count.getRefReadCount();
double altMinorResponsibility;
try {
altMinorResponsibility = Beta.regularizedBeta(0.5, a + 1, r + 1);
} catch (final MaxCountExceededException e) {
altMinorResponsibility = a < r ? 1.0 : 0.0; //if the special function can't be computed, give an all-or-nothing responsibility
}
responsibilityWeightedMinorAlleleReadCount += altMinorResponsibility * a + (1 - altMinorResponsibility) * r;
responsibilityWeightedTotalReadCount += a + r;
}
// we achieve a flat prior via a single pseudocount for minor and non-minor reads, hence the +1 and +2
result.add((responsibilityWeightedMinorAlleleReadCount + 1)/(responsibilityWeightedTotalReadCount + 2));
}
return result;
}
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:38,代码来源:AlleleFractionInitializer.java
示例3: calculateInitialMinorFractions
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/**
* <p>
* Initialize minor fractions assuming no allelic bias.
* </p>
*
* <p>
* We integrate over f to get posterior probabilities (responsibilities) of alt / ref minor
* that is, responsibility of alt minor is int_{0 to 1/2} f^a (1 - f)^r df
* responsibility of ref minor is int_{0 to 1/2} f^r (1 - f)^a df
* These are proportional to I(1/2, a + 1, r + 1) and I(1/2, r + 1, a + 1),
* respectively, where I is the (incomplete) regularized Beta function.
* By definition, these likelihoods sum to 1, i.e., they are already normalized.
* </p>
*
* <p>
* Finally, we set each minor fraction to the responsibility-weighted total count of
* reads in minor allele divided by total reads, ignoring outliers.
* </p>
*/
private AlleleFractionState.MinorFractions calculateInitialMinorFractions(final AlleleFractionSegmentedData data) {
final int numSegments = data.getNumSegments();
final AlleleFractionState.MinorFractions result = new AlleleFractionState.MinorFractions(numSegments);
for (int segment = 0; segment < numSegments; segment++) {
double responsibilityWeightedMinorAlleleReadCount = 0.0;
double responsibilityWeightedTotalReadCount = 0.0;
for (final AllelicCount count : data.getIndexedAllelicCountsInSegment(segment)) {
final int a = count.getAltReadCount();
final int r = count.getRefReadCount();
double altMinorResponsibility;
try {
altMinorResponsibility = Beta.regularizedBeta(0.5, a + 1, r + 1);
} catch (final MaxCountExceededException e) {
altMinorResponsibility = a < r ? 1.0 : 0.0; //if the special function can't be computed, give an all-or-nothing responsibility
}
responsibilityWeightedMinorAlleleReadCount += altMinorResponsibility * a + (1 - altMinorResponsibility) * r;
responsibilityWeightedTotalReadCount += a + r;
}
// we achieve a flat prior via a single pseudocount for minor and non-minor reads, hence the +1 and +2
result.add((responsibilityWeightedMinorAlleleReadCount + 1)/(responsibilityWeightedTotalReadCount + 2));
}
return result;
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:44,代码来源:AlleleFractionInitializer.java
示例4: logDensity
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} **/
@Override
public double logDensity(double x) {
final double nhalf = numeratorDegreesOfFreedom / 2;
final double mhalf = denominatorDegreesOfFreedom / 2;
final double logx = FastMath.log(x);
final double logn = FastMath.log(numeratorDegreesOfFreedom);
final double logm = FastMath.log(denominatorDegreesOfFreedom);
final double lognxm = FastMath.log(numeratorDegreesOfFreedom * x +
denominatorDegreesOfFreedom);
return nhalf * logn + nhalf * logx - logx +
mhalf * logm - nhalf * lognxm - mhalf * lognxm -
Beta.logBeta(nhalf, mhalf);
}
开发者ID:biocompibens,项目名称:SME,代码行数:15,代码来源:FDistribution.java
示例5: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* The implementation of this method is based on
* <ul>
* <li>
* <a href="http://mathworld.wolfram.com/F-Distribution.html">
* F-Distribution</a>, equation (4).
* </li>
* </ul>
*/
public double cumulativeProbability(double x) {
double ret;
if (x <= 0) {
ret = 0;
} else {
double n = numeratorDegreesOfFreedom;
double m = denominatorDegreesOfFreedom;
ret = Beta.regularizedBeta((n * x) / (m + n * x),
0.5 * n,
0.5 * m);
}
return ret;
}
开发者ID:biocompibens,项目名称:SME,代码行数:26,代码来源:FDistribution.java
示例6: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
if (x <= 0) {
return 0;
} else if (x >= 1) {
return 1;
} else {
return Beta.regularizedBeta(x, alpha, beta);
}
}
开发者ID:biocompibens,项目名称:SME,代码行数:11,代码来源:BetaDistribution.java
示例7: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
ret = 0.0;
} else if (x >= numberOfTrials) {
ret = 1.0;
} else {
ret = 1.0 - Beta.regularizedBeta(probabilityOfSuccess,
x + 1.0, numberOfTrials - x);
}
return ret;
}
开发者ID:biocompibens,项目名称:SME,代码行数:14,代码来源:BinomialDistribution.java
示例8: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
ret = 0.0;
} else {
ret = Beta.regularizedBeta(probabilityOfSuccess,
numberOfSuccesses, x + 1.0);
}
return ret;
}
开发者ID:biocompibens,项目名称:SME,代码行数:12,代码来源:PascalDistribution.java
示例9: density
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @since 2.1
*/
public double density(double x) {
final double nhalf = numeratorDegreesOfFreedom / 2;
final double mhalf = denominatorDegreesOfFreedom / 2;
final double logx = FastMath.log(x);
final double logn = FastMath.log(numeratorDegreesOfFreedom);
final double logm = FastMath.log(denominatorDegreesOfFreedom);
final double lognxm = FastMath.log(numeratorDegreesOfFreedom * x +
denominatorDegreesOfFreedom);
return FastMath.exp(nhalf * logn + nhalf * logx - logx +
mhalf * logm - nhalf * lognxm - mhalf * lognxm -
Beta.logBeta(nhalf, mhalf));
}
开发者ID:golharam,项目名称:FastQC,代码行数:18,代码来源:FDistribution.java
示例10: cumulativeProbability
import org.apache.commons.math3.special.Beta; //导入依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
ret = 0.0;
} else {
ret = Beta.regularizedBeta(probabilityOfSuccess,
numberOfSuccesses, x + 1);
}
return ret;
}
开发者ID:golharam,项目名称:FastQC,代码行数:12,代码来源:PascalDistribution.java
注:本文中的org.apache.commons.math3.special.Beta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论