org.apache.commons.math3.stat.descriptive.moment.Mean.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(207)

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

Mean.<init>介绍

[英]Constructs a Mean.
[中]构造一个平均值。

代码示例

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

/** Constructs a VectorialMean.
 * @param dimension vectors dimension
 */
public VectorialMean(int dimension) {
  means = new Mean[dimension];
  for (int i = 0; i < dimension; ++i) {
    means[i] = new Mean();
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public Mean copy() {
  Mean result = new Mean();
  // No try-catch or advertised exception because args are guaranteed non-null
  copy(this, result);
  return result;
}

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

/**
 * This method calculates {@link SemiVariance} for the entire array against the mean, using
 * the current value of the biasCorrection instance property.
 *
 * @param values the input array
 * @param direction the {@link Direction} of the semivariance
 * @return the SemiVariance
 * @throws MathIllegalArgumentException if values is null
 *
 */
public double evaluate(final double[] values, Direction direction)
throws MathIllegalArgumentException {
  double m = (new Mean()).evaluate(values);
  return evaluate (values, m, direction, biasCorrected, 0, values.length);
}

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

/**
 * <p>Returns the {@link SemiVariance} of the designated values against the mean, using
 * instance properties varianceDirection and biasCorrection.</p>
 *
 * <p>Returns <code>NaN</code> if the array is empty and throws
 * <code>IllegalArgumentException</code> if the array is null.</p>
 *
 * @param values the input array
 * @param start index of the first array element to include
 * @param length the number of elements to include
 * @return the SemiVariance
 * @throws MathIllegalArgumentException if the parameters are not valid
 *
 */
 @Override
 public double evaluate(final double[] values, final int start, final int length)
 throws MathIllegalArgumentException {
  double m = (new Mean()).evaluate(values, start, length);
  return evaluate(values, m, varianceDirection, biasCorrected, 0, values.length);
 }

代码示例来源:origin: OryxProject/oryx

protected Endpoint(String path, double relativeProb) {
 Preconditions.checkArgument(relativeProb > 0.0);
 this.path = path;
 this.relativeProb = relativeProb;
 meanTimeNanos = new Mean();
 stdevTimeNanos = new StandardDeviation();
}

代码示例来源:origin: prestodb/presto

public Stat(double[] values)
{
  mean = new Mean().evaluate(values);
  standardDeviation = new StandardDeviation().evaluate(values);
  median = new Median().evaluate(values);
}

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

Mean mean = new Mean();

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

Mean mean = new Mean();
double result = 0d;
int length = xArray.length;

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

var = 0.0;
} else if (length > 1) {
  Mean mean = new Mean();
  double m = mean.evaluate(values, begin, length);
  var = evaluate(values, m, begin, length);

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

var = 0.0;
} else if (length > 1) {
  Mean mean = new Mean();
  double m = mean.evaluate(values, weights, begin, length);
  var = evaluate(values, weights, m, begin, length);

代码示例来源:origin: OryxProject/oryx

@Test
public void testRecommendLoad() throws Exception {
 AtomicLong count = new AtomicLong();
 Mean meanReqTimeNanos = new Mean();
 long start = System.nanoTime();
 int workers = LoadTestALSModelFactory.WORKERS;
 ExecUtils.doInParallel(workers, workers, true, i -> {
  RandomGenerator random = RandomManager.getRandom(Integer.toString(i).hashCode() ^ System.nanoTime());
  for (int j = 0; j < LoadTestALSModelFactory.REQS_PER_WORKER; j++) {
   String userID = "U" + random.nextInt(LoadTestALSModelFactory.USERS);
   long callStart = System.nanoTime();
   target("/recommend/" + userID).request()
     .accept(MediaType.APPLICATION_JSON_TYPE).get(LIST_ID_VALUE_TYPE);
   long timeNanos = System.nanoTime() - callStart;
   if (j > 0) {
    // Ignore first iteration's time as 'burn in'
    synchronized (meanReqTimeNanos) {
     meanReqTimeNanos.increment(timeNanos);
    }
   }
   long currentCount = count.incrementAndGet();
   if (currentCount % 100 == 0) {
    log(currentCount, meanReqTimeNanos, start);
   }
  }
 });
 int totalRequests = workers * LoadTestALSModelFactory.REQS_PER_WORKER;
 log(totalRequests, meanReqTimeNanos, start);
}

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

/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
  this.k = k;
  sumImpl     = new StorelessUnivariateStatistic[k];
  sumSqImpl   = new StorelessUnivariateStatistic[k];
  minImpl     = new StorelessUnivariateStatistic[k];
  maxImpl     = new StorelessUnivariateStatistic[k];
  sumLogImpl  = new StorelessUnivariateStatistic[k];
  geoMeanImpl = new StorelessUnivariateStatistic[k];
  meanImpl    = new StorelessUnivariateStatistic[k];
  for (int i = 0; i < k; ++i) {
    sumImpl[i]     = new Sum();
    sumSqImpl[i]   = new SumOfSquares();
    minImpl[i]     = new Min();
    maxImpl[i]     = new Max();
    sumLogImpl[i]  = new SumOfLogs();
    geoMeanImpl[i] = new GeometricMean();
    meanImpl[i]    = new Mean();
  }
  covarianceImpl =
    new VectorialCovariance(k, isCovarianceBiasCorrected);
}

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

@Nullable
@Override
public Mean createContext(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine engine) {
  return new Mean();
}

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

@Nullable
@Override
public Mean createContext(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine engine) {
  return new Mean();
}

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

@Nullable
@Override
public Mean createContext(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine engine) {
  return new Mean();
}

代码示例来源:origin: OryxProject/oryx

Mean meanMatchLength = new Mean();
for (int user = 0; user < userItemCount; user++) {
 String userID = "U" + user;

代码示例来源:origin: apache/accumulo

public Stat() {
 mean = new Mean();
 clear();
}

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

dest.meanImpl = new Mean(dest.secondMoment);
} else {
  dest.meanImpl = source.meanImpl.copy();

代码示例来源:origin: jpmml/jpmml-evaluator

static
  private Double evaluate(Collection<?> values){
    Mean statistic = new Mean();

    for(Object value : values){
      Number number = (Number)TypeUtil.parseOrCast(DataType.DOUBLE, value);

      statistic.increment(number.doubleValue());
    }

    return statistic.getResult();
  }
}

代码示例来源:origin: dremio/dremio-oss

private static double mean(List<Long> data) {
 double[] asDouble = new double[data.size()];
 int i = 0;
 for (Long l : data) {
  asDouble[i++] = (double) l;
 }
 return new Mean().evaluate(asDouble);
}

相关文章