org.apache.commons.math3.stat.descriptive.moment.Variance.increment()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.commons.math3.stat.descriptive.moment.Variance.increment()方法的一些代码示例,展示了Variance.increment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variance.increment()方法的具体详情如下:
包路径:org.apache.commons.math3.stat.descriptive.moment.Variance
类名称:Variance
方法名:increment

Variance.increment介绍

[英]If all values are available, it is more accurate to use #evaluate(double[]) rather than adding values one at a time using this method and then executing #getResult, since evaluate leverages the fact that is has the full list of values together to execute a two-pass algorithm. See Variance.

Note also that when #Variance(SecondMoment) is used to create a Variance, this method does nothing. In that case, the SecondMoment should be incremented directly.
[中]如果所有值都可用,则使用#evaluate(double[])比使用此方法一次添加一个值,然后执行#getResult更准确,因为evaluate利用is将完整的值列表放在一起的事实来执行两次传递算法。见差异。
还请注意,当使用#方差(SecondMoment)创建方差时,此方法不起任何作用。在这种情况下,第二时刻应该直接递增。

代码示例

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * {@inheritDoc}
 */
@Override
public void increment(final double d) {
  variance.increment(d);
}

代码示例来源:origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
@Override
public double score(final List<? extends Cluster<T>> clusters) {
  double varianceSum = 0.0;
  for (final Cluster<T> cluster : clusters) {
    if (!cluster.getPoints().isEmpty()) {
      final Clusterable center = centroidOf(cluster);
      // compute the distance variance of the current cluster
      final Variance stat = new Variance();
      for (final T point : cluster.getPoints()) {
        stat.increment(distance(point, center));
      }
      varianceSum += stat.getResult();
    }
  }
  return varianceSum;
}

代码示例来源:origin: org.apache.commons/commons-math3

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: org.apache.commons/commons-math3

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(distance(point, center));

代码示例来源:origin: org.apache.commons/commons-math3

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: geogebra/geogebra

/**
 * {@inheritDoc}
 */
@Override
public void increment(final double d) {
  variance.increment(d);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * {@inheritDoc}
 */
@Override
public void increment(final double d) {
  variance.increment(d);
}

代码示例来源:origin: meyerjp3/psychometrics

/**
 * An incremental update to the scale quality statistics.
 *
 * @param estimate a person ability or item difficulty estimate.
 * @param stdError
 */
public void increment(double estimate, double stdError){
  var.increment(estimate);
  mean.increment(Math.pow(stdError, 2));
}

代码示例来源:origin: zavtech/morpheus-core

public static void main(String[] args) {
  final double[] values = new java.util.Random().doubles(5000).toArray();
  final Variance stat1 = new Variance(true);
  final org.apache.commons.math3.stat.descriptive.moment.Variance stat2 = new org.apache.commons.math3.stat.descriptive.moment.Variance(true);
  for (double value : values) {
    stat1.add(value);
    stat2.increment(value);
  }
  final double result1 = stat1.getValue();
  final double result2 = stat2.getResult();
  if (result1 != result2) {
    throw new RuntimeException("Error: " + result1 + " != " + result2);
  }
}

代码示例来源:origin: geogebra/geogebra

/** {@inheritDoc} */
@Override
public double score(final List<? extends Cluster<T>> clusters) {
  double varianceSum = 0.0;
  for (final Cluster<T> cluster : clusters) {
    if (!cluster.getPoints().isEmpty()) {
      final Clusterable center = centroidOf(cluster);
      // compute the distance variance of the current cluster
      final Variance stat = new Variance();
      for (final T point : cluster.getPoints()) {
        stat.increment(distance(point, center));
      }
      varianceSum += stat.getResult();
    }
  }
  return varianceSum;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** {@inheritDoc} */
@Override
public double score(final List<? extends Cluster<T>> clusters) {
  double varianceSum = 0.0;
  for (final Cluster<T> cluster : clusters) {
    if (!cluster.getPoints().isEmpty()) {
      final Clusterable center = centroidOf(cluster);
      // compute the distance variance of the current cluster
      final Variance stat = new Variance();
      for (final T point : cluster.getPoints()) {
        stat.increment(distance(point, center));
      }
      varianceSum += stat.getResult();
    }
  }
  return varianceSum;
}

代码示例来源:origin: geogebra/geogebra

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: io.virtdata/virtdata-lib-realer

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: geogebra/geogebra

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(distance(point, center));

代码示例来源:origin: io.virtdata/virtdata-lib-realer

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(distance(point, center));

代码示例来源:origin: senbox-org/s2tbx

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(distance(point, center));

代码示例来源:origin: geogebra/geogebra

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: io.virtdata/virtdata-lib-realer

final Variance stat = new Variance();
for (final T point : cluster.getPoints()) {
  stat.increment(point.distanceFrom(center));

代码示例来源:origin: us.ihmc/joctomap

private static void computeNormalConsensusAndVariance(Point3DReadOnly pointOnPlane, Vector3DReadOnly planeNormal, Iterable<NormalOcTreeNode> neighbors,
                             double maxDistanceFromPlane, MutableDouble varianceToPack, MutableInt consensusToPack)
  {
   Variance variance = new Variance();
   consensusToPack.setValue(0);

   Vector3D toNeighborHitLocation = new Vector3D();

   for (NormalOcTreeNode neighbor : neighbors)
   {
     toNeighborHitLocation.set(neighbor.getHitLocationX(), neighbor.getHitLocationY(), neighbor.getHitLocationZ());
     toNeighborHitLocation.sub(pointOnPlane);
     double distanceFromPlane = Math.abs(planeNormal.dot(toNeighborHitLocation));
     if (distanceFromPlane <= maxDistanceFromPlane)
     {
      variance.increment(distanceFromPlane);
      consensusToPack.increment();
     }
   }

   if (consensusToPack.intValue() == 0)
     varianceToPack.setValue(Double.POSITIVE_INFINITY);
   else
     varianceToPack.setValue(variance.getResult());
  }
}

相关文章