org.apache.commons.math3.stat.descriptive.rank.Percentile.evaluate()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(310)

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

Percentile.evaluate介绍

[英]Returns the result of evaluating the statistic over the stored data.

The stored array is the one which was set by previous calls to #setData(double[])
[中]返回对存储数据进行统计评估的结果。
存储的数组是以前调用#setData(double[])时设置的数组

代码示例

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

/**
 * Returns an estimate of the <code>p</code>th percentile of the values
 * in the <code>values</code> array.
 * <p>
 * <ul>
 * <li>Returns <code>Double.NaN</code> if <code>values</code> has length
 * <code>0</code></li></p>
 * <li>Returns (for any value of <code>p</code>) <code>values[0]</code>
 *  if <code>values</code> has length <code>1</code></li>
 * <li>Throws <code>IllegalArgumentException</code> if <code>values</code>
 * is null  or p is not a valid quantile value (p must be greater than 0
 * and less than or equal to 100)</li>
 * </ul></p>
 * <p>
 * See {@link org.apache.commons.math3.stat.descriptive.rank.Percentile} for
 * a description of the percentile estimation algorithm used.</p>
 *
 * @param values input array of values
 * @param p the percentile value to compute
 * @return the percentile value or Double.NaN if the array is empty
 * @throws MathIllegalArgumentException if <code>values</code> is null
 * or p is invalid
 */
public static double percentile(final double[] values, final double p)
throws MathIllegalArgumentException {
    return PERCENTILE.evaluate(values,p);
}

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

/**
 * Returns an estimate of the <code>quantile</code>th percentile of the
 * designated values in the <code>values</code> array.  The quantile
 * estimated is determined by the <code>quantile</code> property.
 * <p>
 * <ul>
 * <li>Returns <code>Double.NaN</code> if <code>length = 0</code></li>
 * <li>Returns (for any value of <code>quantile</code>)
 * <code>values[begin]</code> if <code>length = 1 </code></li>
 * <li>Throws <code>MathIllegalArgumentException</code> if <code>values</code>
 * is null, or <code>start</code> or <code>length</code> is invalid</li>
 * </ul></p>
 * <p>
 * See {@link Percentile} for a description of the percentile estimation
 * algorithm used.</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 percentile value
 * @throws MathIllegalArgumentException if the parameters are not valid
 *
 */
@Override
public double evaluate(final double[] values, final int start, final int length)
throws MathIllegalArgumentException {
  return evaluate(values, start, length, quantile);
}

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

return PERCENTILE.evaluate(values, begin, length, p);

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

/**
 * Returns the result of evaluating the statistic over the stored data.
 * <p>
 * The stored array is the one which was set by previous calls to
 * {@link #setData(double[])}
 * </p>
 * @param p the percentile value to compute
 * @return the value of the statistic applied to the stored data
 * @throws MathIllegalArgumentException if p is not a valid quantile value
 * (p must be greater than 0 and less than or equal to 100)
 */
public double evaluate(final double p) throws MathIllegalArgumentException {
  return evaluate(getDataRef(), p);
}

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

throws MathIllegalArgumentException {
  test(values, 0, 0);
  return evaluate(values, 0, values.length, p);

代码示例来源:origin: linkedin/cruise-control

double upperPercentileMetricValue = _percentile.evaluate(_anomalyUpperPercentile);
if (upperPercentileMetricValue <= SIGNIFICANT_METRIC_VALUE_THRESHOLD) {
 return null;
double lowerThreshold = _percentile.evaluate(_anomalyLowerPercentile) * _anomalyLowerMargin;
double currentMetricValue = current.metricValues().valuesFor(metricId).latest();

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

public double[] evaluate(double[] x){
  double[] ci = new double[2];
  ci[0] = percentile.evaluate(x, lower);
  ci[1] = percentile.evaluate(x, upper);
  return ci;
}

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

public double[] value(double[] x){
  double[] value = new double[size];
  for(int i=0;i<size;i++){
    value[i] = q[i].evaluate(x, prob[i]);
  }
  return value;
}

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

public double[] value(double[] x){
  double[] value = new double[size];
  for(int i=0;i<size;i++){
    value[i] = q[i].evaluate(x, prob[i]);
  }
  return value;
}

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

public double value(){
  StandardDeviation sd = new StandardDeviation();
  double q3 = pcntl.evaluate(x, 75.0);
  double q1 = pcntl.evaluate(x, 25.0);
  double IQR = (q3-q1)/1.34;
  double s = sd.evaluate(x);
  double N = (double)x.length;
  double m = Math.min(s, IQR);
  return 1.06*m*Math.pow(N, -1.0/5.0)*adjustmentFactor;
}

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

/**
 * Returns the result of evaluating the statistic over the stored data.
 * <p>
 * The stored array is the one which was set by previous calls to
 * {@link #setData(double[])}
 * </p>
 * @param p the percentile value to compute
 * @return the value of the statistic applied to the stored data
 * @throws MathIllegalArgumentException if p is not a valid quantile value
 * (p must be greater than 0 and less than or equal to 100)
 */
public double evaluate(final double p) throws MathIllegalArgumentException {
  return evaluate(getDataRef(), p);
}

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

/**
 * Returns the result of evaluating the statistic over the stored data.
 * <p>
 * The stored array is the one which was set by previous calls to
 * {@link #setData(double[])}
 * </p>
 * @param p the percentile value to compute
 * @return the value of the statistic applied to the stored data
 * @throws MathIllegalArgumentException if p is not a valid quantile value
 * (p must be greater than 0 and less than or equal to 100)
 */
public double evaluate(final double p) throws MathIllegalArgumentException {
  return evaluate(getDataRef(), p);
}

代码示例来源:origin: salesforce/Argus

private Double findPivot(Map<Long, Double> datapoints, Double limit) {
  double[] doubleValues = new double[datapoints.size()];
  int k = 0;
  for (Map.Entry<Long, Double> entry : datapoints.entrySet()) {
    doubleValues[k] = entry.getValue();
    k++;
  }
  Arrays.sort(doubleValues);
  double pivotValue = Double.MAX_VALUE;
  try {
    pivotValue = new Percentile().evaluate(doubleValues, (double) limit);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Please provide a valid percentile number!");
  }
  return pivotValue;
}

代码示例来源:origin: com.salesforce.argus/argus-core

private Double findPivot(Map<Long, Double> datapoints, Double limit) {
  double[] doubleValues = new double[datapoints.size()];
  int k = 0;
  for (Map.Entry<Long, Double> entry : datapoints.entrySet()) {
    doubleValues[k] = entry.getValue();
    k++;
  }
  Arrays.sort(doubleValues);
  double pivotValue = Double.MAX_VALUE;
  try {
    pivotValue = new Percentile().evaluate(doubleValues, (double) limit);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Please provide a valid percentile number!");
  }
  return pivotValue;
}

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

@Override
  public double doublePercentile(int percentile){

    if(this.size == 0){
      throw new IllegalStateException();
    }

    double[] data = new double[this.size];

    System.arraycopy(this.values, 0, data, 0, data.length);

    Arrays.sort(data);

    Percentile statistic = new Percentile();
    statistic.setData(data);

    return statistic.evaluate(percentile);
  }
}

代码示例来源:origin: salesforce/Argus

private Double _calculateNthPercentile(Collection<Double> values, Double percentileValue) {
  return new Percentile().evaluate(Doubles.toArray(values), percentileValue);
}

代码示例来源:origin: com.salesforce.argus/argus-core

private Double _calculateNthPercentile(Collection<Double> values, Double percentileValue) {
  return new Percentile().evaluate(Doubles.toArray(values), percentileValue);
}

代码示例来源:origin: salesforce/Argus

private double _calculateValue(double sum, List<Double> numberArr, int count, InternalReducerType type) {
    
  if (InternalReducerType.MEDIAN.equals(type)) {
    double[] numbers = ArrayUtils.toPrimitive(numberArr.toArray(new Double[numberArr.size()]));
    return new Percentile().evaluate(numbers, 50.0);
  } 
  
  if(InternalReducerType.AVG.equals(type)) {
    return (sum / count);
  }
  
  return sum;
}

代码示例来源:origin: com.salesforce.argus/argus-core

private double _calculateValue(double sum, List<Double> numberArr, int count, InternalReducerType type) {
    
  if (InternalReducerType.MEDIAN.equals(type)) {
    double[] numbers = ArrayUtils.toPrimitive(numberArr.toArray(new Double[numberArr.size()]));
    return new Percentile().evaluate(numbers, 50.0);
  } 
  
  if(InternalReducerType.AVG.equals(type)) {
    return (sum / count);
  }
  
  return sum;
}

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

@Override
public double getValue() {
  return new org.apache.commons.math3.stat.descriptive.rank.Percentile(nth * 100)
    .withEstimationType(org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_7)
    .withNaNStrategy(NaNStrategy.FIXED)
    .evaluate(values, 0, n);
}

相关文章