本文整理了Java中net.imglib2.util.Util.percentile()
方法的一些代码示例,展示了Util.percentile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.percentile()
方法的具体详情如下:
包路径:net.imglib2.util.Util
类名称:Util
方法名:percentile
[英]Computes the percentile of a collection of doubles (percentile 0.5 roughly corresponds to median)
[中]计算双倍集合的百分位(百分位0.5大致对应于中位数)
代码示例来源:origin: fiji/TrackMate
protected double computeAlternativeCosts()
{
if ( percentile == 1 ) { return alternativeCostFactor * Util.max( costs ); }
return alternativeCostFactor * Util.percentile( costs, percentile );
}
代码示例来源:origin: sc.fiji/TrackMate_
protected double computeAlternativeCosts()
{
if ( percentile == 1 ) { return alternativeCostFactor * Util.max( costs ); }
return alternativeCostFactor * Util.percentile( costs, percentile );
}
代码示例来源:origin: imglib/imglib2
@Test
public void testPercentile()
{
final double[] data = new double[42];
for(int i = 0; i < data.length; i++) {
data[i] = Math.random()*42;
}
final double[] sortedData = data.clone();
final double[] quicksortedData = data.clone();
Arrays.sort( sortedData );
quicksort( quicksortedData );
for(int i = 0; i < 3; i++){
double percentile = Math.random();
int pos = Math.min( data.length - 1,
Math.max( 0, ( int ) Math.round( ( data.length - 1 ) * percentile ) ) );
final double percentileRes = percentile( data, percentile );
assertEquals(quicksortedData[pos], sortedData[pos], 0.001);
assertEquals(quicksortedData[pos], percentileRes, 0.001);
}
}
内容来源于网络,如有侵权,请联系作者删除!