本文整理汇总了Java中org.apache.commons.math.stat.StatUtils.variance方法的典型用法代码示例。如果您正苦于以下问题:Java StatUtils.variance方法的具体用法?Java StatUtils.variance怎么用?Java StatUtils.variance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.stat.StatUtils
的用法示例。
在下文中一共展示了StatUtils.variance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testVarianceDecompMeanCutoff
import org.apache.commons.math.stat.StatUtils; //导入方法依赖的package包/类
/**
* Check that the lower + upper semivariance against the mean sum to the
* variance.
*/
public void testVarianceDecompMeanCutoff() {
double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d };
double variance = StatUtils.variance(values);
SemiVariance sv = new SemiVariance(true); // Bias corrected
sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE);
final double lower = sv.evaluate(values);
sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE);
final double upper = sv.evaluate(values);
assertEquals(variance, lower + upper, 10e-12);
}
示例2: testVarianceDecompMeanCutoff
import org.apache.commons.math.stat.StatUtils; //导入方法依赖的package包/类
/**
* Check that the lower + upper semivariance against the mean sum to the
* variance.
*/
@Test
public void testVarianceDecompMeanCutoff() {
double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d };
double variance = StatUtils.variance(values);
SemiVariance sv = new SemiVariance(true); // Bias corrected
sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE);
final double lower = sv.evaluate(values);
sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE);
final double upper = sv.evaluate(values);
Assert.assertEquals(variance, lower + upper, 10e-12);
}
示例3: getVariance
import org.apache.commons.math.stat.StatUtils; //导入方法依赖的package包/类
/**
*
* @param list
* @return
*/
public double getVariance(List<SynsetOut> list) {
double[] scores = new double[list.size()];
int l = 0;
for (SynsetOut out : list) {
scores[l] = out.getScore();
l++;
}
return StatUtils.variance(scores);
}
示例4: extractVariance
import org.apache.commons.math.stat.StatUtils; //导入方法依赖的package包/类
/**
* Return the variance of the content of the points in the set.
* @param <T> Type of ITrainingPoint to split.
* @param set set to compute the variance from.
* @return the variance of the content of the points in the set.
*/
protected <T extends ITrainingPoint<R, C>> double extractVariance(Collection<T> set)
{
double[] values = new double[set.size()];
int i = 0;
for (T element : set)
{
C number = element.getContent();
values[i] = number.doubleValue();
i++;
}
return StatUtils.variance(values);
}