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

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

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

Median.<init>介绍

[英]Default constructor.
[中]默认构造函数。

代码示例

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

/**
 * Get median value for given statistics.
 * @param data collected datapoints.
 * @return median value.
 */
private static double median(@NotNull DescriptiveStatistics data) {
 return new Median().evaluate(data.getValues());
}

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

/** {@inheritDoc} */
@Override
public Median withNaNStrategy(final NaNStrategy newNaNStrategy) {
  return new Median(getEstimationType(), newNaNStrategy, getKthSelector());
}

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

/** {@inheritDoc} */
@Override
public Median withEstimationType(final EstimationType newEstimationType) {
  return new Median(newEstimationType, getNaNStrategy(), getKthSelector());
}

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

/** {@inheritDoc} */
@Override
public Median withKthSelector(final KthSelector newKthSelector) {
  return new Median(getEstimationType(), getNaNStrategy(), newKthSelector);
}

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

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

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Calculates Transit center from median of coordinates of all transitStops if graph
 * has transit. If it doesn't it isn't calculated. (mean walue of min, max latitude and longitudes are used)
 *
 * Transit center is saved in center variable
 *
 * This speeds up calculation, but problem is that median needs to have all of latitudes/longitudes
 * in memory, this can become problematic in large installations. It works without a problem on New York State.
 */
public void calculateTransitCenter() {
  if (hasTransit) {
    TDoubleList latitudes = new TDoubleLinkedList();
    TDoubleList longitudes = new TDoubleLinkedList();
    Median median = new Median();
    getVertices().stream()
      .filter(v -> v instanceof TransitStop)
      .forEach(v -> {
        latitudes.add(v.getLat());
        longitudes.add(v.getLon());
      });
    median.setData(latitudes.toArray());
    double medianLatitude = median.evaluate();
    median = new Median();
    median.setData(longitudes.toArray());
    double medianLongitude = median.evaluate();
    this.center = new Coordinate(medianLongitude, medianLatitude);
  }
}

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

public MetaScores(List<Double> scores) {
 // A meta alert could be entirely alerts with no values.
 DoubleSummaryStatistics stats = scores
   .stream()
   .mapToDouble(a -> a)
   .summaryStatistics();
 metaScores.put("max", stats.getMax());
 metaScores.put("min", stats.getMin());
 metaScores.put("average", stats.getAverage());
 metaScores.put("count", stats.getCount());
 metaScores.put("sum", stats.getSum());
 // median isn't in the stats summary
 double[] arr = scores
   .stream()
   .mapToDouble(d -> d)
   .toArray();
 metaScores.put("median", new Median().evaluate(arr));
}

代码示例来源:origin: stackoverflow.com

import org.apache.commons.math3.*;
.....
......
........
//calculate median
public double getMedian(double[] values){
 Median median = new Median();
 double medianValue = median.evaluate(values);
 return medianValue;
}
.......

代码示例来源:origin: NemProject/nem.core

/**
 * Gets the median value of all elements in this vector.
 *
 * @return The median value of all elements in this vector.
 */
public double median() {
  final Median median = new Median();
  return median.evaluate(this.vector);
}

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

/** {@inheritDoc} */
@Override
public Median withEstimationType(final EstimationType newEstimationType) {
  return new Median(newEstimationType, getNaNStrategy(), getKthSelector());
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
   // TODO Auto-generated method stub
   // need to call methods
   //creating object
   Median m = new Median();
   //calling methods from the object
   m.selectionSort();
   m.median();
 }

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

/** {@inheritDoc} */
@Override
public Median withNaNStrategy(final NaNStrategy newNaNStrategy) {
  return new Median(getEstimationType(), newNaNStrategy, getKthSelector());
}

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

/** {@inheritDoc} */
@Override
public Median withKthSelector(final KthSelector newKthSelector) {
  return new Median(getEstimationType(), getNaNStrategy(), newKthSelector);
}

代码示例来源:origin: io.github.msdk/msdk-featdet-chromatogrambuilder

@Nonnull
Double calculateMz() {
 if (mzValues.isEmpty())
  throw new MSDKRuntimeException("Cannot calculate the m/z value of an empty chromatogram");
 // Convert the m/z values to an array
 double mzDoubleValues[] = Doubles.toArray(mzValues);
 // Calculate the final m/z value as a median of all m/z values
 Median median = new Median();
 double medianValue = median.evaluate(mzDoubleValues);
 return medianValue;
}

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

/** {@inheritDoc} */
@Override
public Median withKthSelector(final KthSelector newKthSelector) {
  return new Median(getEstimationType(), getNaNStrategy(), newKthSelector);
}

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

/** {@inheritDoc} */
@Override
public Median withNaNStrategy(final NaNStrategy newNaNStrategy) {
  return new Median(getEstimationType(), newNaNStrategy, getKthSelector());
}

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

/** {@inheritDoc} */
@Override
public Median withEstimationType(final EstimationType newEstimationType) {
  return new Median(newEstimationType, getNaNStrategy(), getKthSelector());
}

代码示例来源:origin: io.github.msdk/msdk-featuredetection-chromatogrambuilder

@Nonnull
Double calculateMz() {
 if (mzValues.isEmpty())
  throw new MSDKRuntimeException("Cannot calculate the m/z value of an empty chromatogram");
 // Convert the m/z values to an array
 double mzDoubleValues[] = Doubles.toArray(mzValues);
 // Calculate the final m/z value as a median of all m/z values
 Median median = new Median();
 double medianValue = median.evaluate(mzDoubleValues);
 return medianValue;
}

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

public static void main(String[] args) {
  final double[] values = new java.util.Random().doubles(5000).toArray();
  final Percentile stat1 = new Percentile(0.5);
  final Median stat2 = new Median();
  for (double value : values) stat1.add(value);
  final double result1 = stat1.getValue();
  final double result2 = stat2.evaluate(values);
  if (result1 != result2) {
    throw new RuntimeException("Error: " + result1 + " != " + result2);
  }
}

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

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

相关文章