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


Java Variance.increment方法代码示例

本文整理汇总了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()));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:41,代码来源:KMeansPlusPlusClusterer.java

示例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();
}
 
开发者ID:rvesse,项目名称:sparql-query-bm,代码行数:9,代码来源:OperationStatsImpl.java

示例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();
}
 
开发者ID:rvesse,项目名称:sparql-query-bm,代码行数:9,代码来源:OperationMixStatsImpl.java


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