本文整理汇总了Java中org.apache.commons.math.stat.descriptive.moment.Variance.increment方法的典型用法代码示例。如果您正苦于以下问题:Java Variance.increment方法的具体用法?Java Variance.increment怎么用?Java Variance.increment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.stat.descriptive.moment.Variance
的用法示例。
在下文中一共展示了Variance.increment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPointFromLargestVarianceCluster
import org.apache.commons.math.stat.descriptive.moment.Variance; //导入方法依赖的package包/类
/**
* Get a random point from the {@link Cluster} with the largest distance variance.
*
* @param clusters the {@link Cluster}s to search
* @return a random point from the selected cluster
*/
private T getPointFromLargestVarianceCluster(final Collection<Cluster<T>> clusters) {
double maxVariance = Double.NEGATIVE_INFINITY;
Cluster<T> selected = null;
for (final Cluster<T> cluster : clusters) {
if (!cluster.getPoints().isEmpty()) {
// compute the distance variance of the current cluster
final T center = cluster.getCenter();
final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
stat.increment(point.distanceFrom(center));
}
final double variance = stat.getResult();
// select the cluster with the largest variance
if (variance > maxVariance) {
maxVariance = variance;
selected = cluster;
}
}
}
// did we find at least one non-empty cluster ?
if (selected == null) {
throw new ConvergenceException(LocalizedFormats.EMPTY_CLUSTER_IN_K_MEANS);
}
// extract a random point from the cluster
final List<T> selectedPoints = selected.getPoints();
return selectedPoints.remove(random.nextInt(selectedPoints.size()));
}
示例2: getVariance
import org.apache.commons.math.stat.descriptive.moment.Variance; //导入方法依赖的package包/类
@Override
public double getVariance() {
Variance var = new Variance();
for (OperationRun r : this.runs) {
var.increment(r.getRuntime());
}
return var.getResult();
}
示例3: getVariance
import org.apache.commons.math.stat.descriptive.moment.Variance; //导入方法依赖的package包/类
@Override
public double getVariance() {
Variance var = new Variance();
for (OperationMixRun r : this.runs) {
var.increment(r.getTotalRuntime());
}
return var.getResult();
}