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


Java DescriptiveStatistics.getPercentile方法代码示例

本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.DescriptiveStatistics.getPercentile方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveStatistics.getPercentile方法的具体用法?Java DescriptiveStatistics.getPercentile怎么用?Java DescriptiveStatistics.getPercentile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.stat.descriptive.DescriptiveStatistics的用法示例。


在下文中一共展示了DescriptiveStatistics.getPercentile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public Data process(Data item) {
    int[][] singlePulses = (int[][]) item.get(singlePulsesKey);
    double[] arrivalTimes = new double[singlePulses.length];

    for (int pix = 0; pix < singlePulses.length; pix++) {
        if (singlePulses[pix].length == 0) {
            arrivalTimes[pix] = 0.; // use zero instead of NaN - plotter likes no NaN
        } else {
            DescriptiveStatistics stat = new DescriptiveStatistics();
            for (int slice : singlePulses[pix]) {
                stat.addValue((double) slice);
            }
            arrivalTimes[pix] = stat.getPercentile(50);
        }
    }
    item.put(arrivalTimeKey, arrivalTimes);
    return item;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:20,代码来源:PhotonStream2ArrivalTime.java

示例2: testQuantiles

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Test
public void testQuantiles() {
    Random r = new Random(0);
    List<DataPoint> points = new ArrayList<>();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    Distribution distribution = null;
    for(int i = 0; i < 100;++i) {
        double val = r.nextDouble()*1000;
        DataPoint dp = (new DataPoint(i, val, null, "foo"));
        points.add(dp);
        stats.addValue(val);
        if(distribution == null) {
            distribution = new Distribution(dp, ScalingFunctions.NONE, new GlobalStatistics());
        }
        else {
            distribution.addDataPoint(dp, ScalingFunctions.NONE);
        }
    }
    double realMedian = stats.getPercentile(50);
    double approxMedian = distribution.getMedian();
    System.out.println("mean and std dev: " + stats.getMean() + ", " + Math.sqrt(stats.getVariance()));
    System.out.println("Real : " + realMedian + ", approx: " + approxMedian);
    Assert.assertTrue(Math.abs(realMedian - approxMedian) < 5);
}
 
开发者ID:cestella,项目名称:streaming_outliers,代码行数:25,代码来源:DistributionTest.java

示例3: getDescStats

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public void getDescStats(double[] values){
	DescriptiveStatistics stats = new DescriptiveStatistics();
	for( int i = 0; i < values.length; i++) {
	        stats.addValue(values[i]);
	}
	double mean = stats.getMean();
	double std = stats.getStandardDeviation();
	double median = stats.getPercentile(50);
	System.out.println(mean + "\t" + std + "\t" + median);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:11,代码来源:DescriptiveStats.java

示例4: medianMisMatch

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private static int medianMisMatch (String matchLine) {
	DescriptiveStatistics stats = new DescriptiveStatistics();
	for (int i=0; i<matchLine.length(); i++) {
		if  (matchLine.substring(i, i+1).equals(" ")) {
			stats.addValue(i+1);
		}
	}
	double median = 100 * (double) stats.getPercentile(50) / (double) matchLine.length();
	return (int) median;
}
 
开发者ID:hivdb,项目名称:sierra,代码行数:11,代码来源:BlastXmlOutputParser.java

示例5: isOutlierByModifiedZScore

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private boolean isOutlierByModifiedZScore(DescriptiveStatistics stats, double value)
{
    double median = stats.getPercentile(50);
    double medianAbsoluteDeviation = new DescriptiveStatistics(
        Arrays.stream(stats.getValues()).map(v -> Math.abs(v - median)).toArray()).getPercentile(50);
    double modifiedZScore = 0.6745 * (value - median) / medianAbsoluteDeviation;

    return Math.abs(modifiedZScore) > 3.5;
}
 
开发者ID:marcelovca90,项目名称:anti-spam-weka-gui,代码行数:10,代码来源:ExperimentHelper.java

示例6: isOutlierByInterquartileRange

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private boolean isOutlierByInterquartileRange(DescriptiveStatistics stats, double value)
{
    double quartile1 = stats.getPercentile(25);
    double quartile3 = stats.getPercentile(75);
    double iqr = quartile3 - quartile1;
    double lowerBound = quartile1 - (iqr * 1.5);
    double upperBound = quartile3 + (iqr * 1.5);

    return (value < lowerBound || value > upperBound);
}
 
开发者ID:marcelovca90,项目名称:anti-spam-weka-gui,代码行数:11,代码来源:ExperimentHelper.java

示例7: label

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public DescriptiveStatistics label(final Serializable[] preds, final Object[] expected, final double[] weights,
		final ISamples<?, ?> samples, final int labelIndex) {
	final DescriptiveStatistics stats = new DescriptiveStatistics();
	for (int i = 0; i < preds.length; ++i) {
		final double[] predAndAct = toDouble(preds[i], expected[i]);
		stats.addValue(Math.abs(predAndAct[0] - predAndAct[1]));
	}
	return new DescriptiveStatistics(new double[] { stats.getPercentile(50) });
}
 
开发者ID:ProfilingIO,项目名称:insight-ml,代码行数:11,代码来源:MedianError.java

示例8: prediction

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private double prediction(final DescriptiveStatistics stats) {
	switch (nodePrediction) {
	case "mean":
		return stats.getMean();
	case "median":
		return stats.getPercentile(50);
	case "meandian":
		return (stats.getMean() + stats.getPercentile(50)) / 2;
	default:
		throw new IllegalArgumentException(nodePrediction);
	}
}
 
开发者ID:ProfilingIO,项目名称:insight-ml,代码行数:13,代码来源:GrowJob.java

示例9: getResult

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public float getResult() {
    if (count == 0)
        return Float.NaN;
    
    double[] primitiveValues = new double[floatValues.size()];
    for (int i = 0; i < floatValues.size(); i++)
        primitiveValues[i] = floatValues.get(i);
    DescriptiveStatistics stats = new DescriptiveStatistics(primitiveValues);
    
    return (float) stats.getPercentile(50);
}
 
开发者ID:ViDA-NYU,项目名称:data-polygamy,代码行数:13,代码来源:Median.java

示例10: getIQR

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public double getIQR(ArrayList<Float> arrayList) {
    double[] vals = new double[arrayList.size()];
    for (int i = 0; i < arrayList.size(); i++) {
        vals[i] = (double)arrayList.get(i);
    }
    DescriptiveStatistics ds = new DescriptiveStatistics(vals);
    double fq = ds.getPercentile(25);
    double tq = ds.getPercentile(75);
    return (tq - fq);
}
 
开发者ID:ViDA-NYU,项目名称:data-polygamy,代码行数:11,代码来源:NoiseExp.java

示例11: apply

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private Double apply(ITimeSeriesUnivariate t) {
	List<Double> vals = t.getValues();
	double[] da = new double[vals.size()];
	for (int i = 0; i < vals.size(); i++) {
		da[i] = vals.get(i);
	}
	DescriptiveStatistics ds = new DescriptiveStatistics(da);
	return ds.getPercentile(50);
}
 
开发者ID:TKnudsen,项目名称:timeSeries,代码行数:10,代码来源:Value2ndQuartileFeatureExtractor.java

示例12: apply

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private Double apply(ITimeSeriesUnivariate t) {
	List<Double> vals = t.getValues();
	double[] da = new double[vals.size()];
	for (int i = 0; i < vals.size(); i++) {
		da[i] = vals.get(i);
	}
	DescriptiveStatistics ds = new DescriptiveStatistics(da);
	return ds.getPercentile(75);
}
 
开发者ID:TKnudsen,项目名称:timeSeries,代码行数:10,代码来源:Value3rdQuartileFeatureExtractor.java

示例13: apply

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private Double apply(ITimeSeriesUnivariate t) {
	List<Double> vals = t.getValues();
	double[] da = new double[vals.size()];
	for (int i = 0; i < vals.size(); i++) {
		da[i] = vals.get(i);
	}
	DescriptiveStatistics ds = new DescriptiveStatistics(da);
	return ds.getPercentile(25);
}
 
开发者ID:TKnudsen,项目名称:timeSeries,代码行数:10,代码来源:Value1stQuartileFeatureExtractor.java

示例14: getMedian

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private Double getMedian(final String feature) {
	final DescriptiveStatistics stat = stats.get(feature);
	return stat == null ? null : stat.getPercentile(50);
}
 
开发者ID:ProfilingIO,项目名称:insight-ml,代码行数:5,代码来源:FeatureStatistics.java

示例15: process

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public Data process(Data item) {
    Utils.isKeyValid(item, "NPIX", Integer.class);
    npix = (Integer) item.get("NPIX");

    Utils.mapContainsKeys(item, dataKey);

    int[][] data = (int[][]) item.get(dataKey);

    double[] mean = new double[npix];
    double[] median = new double[npix];
    double[] mode = new double[npix];
    double[] std = new double[npix];
    double[] kurtosis = new double[npix];
    double[] skewness = new double[npix];
    double[] min = new double[npix];
    double[] max = new double[npix];
    double[] quantil25 = new double[npix];
    double[] quantil75 = new double[npix];

    for (int pix = 0; pix < npix; pix++) {
        double[] values = Utils.toDoubleArray(data[pix]);


        ///FIXME: fill nans instead of continue
        if (values.length == 0) {
            continue;
        }

        DescriptiveStatistics stats = new DescriptiveStatistics(values);
        mean[pix] = stats.getMean();
        min[pix] = stats.getMin();
        max[pix] = stats.getMax();
        std[pix] = stats.getStandardDeviation();
        skewness[pix] = stats.getSkewness();
        kurtosis[pix] = stats.getKurtosis();
        quantil25[pix] = stats.getPercentile(0.25);
        quantil75[pix] = stats.getPercentile(0.75);
        median[pix] = stats.getPercentile(0.5);

        double[] modeArray = StatUtils.mode(values);
        mode[pix] = modeArray[0];
    }

    item.put(outputKey + "_mean", mean);
    item.put(outputKey + "_median", median);
    item.put(outputKey + "_mode", mode);
    item.put(outputKey + "_std", std);
    item.put(outputKey + "_kurtosis", kurtosis);
    item.put(outputKey + "_skewness", skewness);
    item.put(outputKey + "_min", min);
    item.put(outputKey + "_max", max);
    item.put(outputKey + "_quantil25", quantil25);
    item.put(outputKey + "_quantil75", quantil75);


    return item;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:59,代码来源:SinglePeStatisticsPixel.java


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