本文整理汇总了Java中cern.jet.stat.Descriptive.quantiles方法的典型用法代码示例。如果您正苦于以下问题:Java Descriptive.quantiles方法的具体用法?Java Descriptive.quantiles怎么用?Java Descriptive.quantiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.jet.stat.Descriptive
的用法示例。
在下文中一共展示了Descriptive.quantiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: report
import cern.jet.stat.Descriptive; //导入方法依赖的package包/类
@Override
public Object report(Argument args[], Context context)
throws ExtensionException, LogoException {
LogoStatsTbl tbl = StatsExtension.getTblFromArgument(args[0]);
int varNumber = ExtnUtils.getVarNumberFromArg(tbl, args[1]);
int n;
try {
n = args[2].getIntValue();
} catch (LogoException e) {
throw new ExtensionException(e.getMessage());
}
if (n < 0) {
throw new ExtensionException("The number of quantiles must"
+ " greater or equal to zero.");
}
double incr = 1.0 / n;
double[] breaks = new double[n + 1];
for (int i = 0; i < n; i++) {
breaks[i] = incr * i;
}
breaks[n] = 1.0;
double[] X = tbl.getColumn(varNumber, true);
Sorting.mergeSort(X, 0, X.length);
DoubleArrayList results
= Descriptive.quantiles(new DoubleArrayList(X),
new DoubleArrayList(breaks));
return ExtnUtils.convertVectorToSimpleLogoList(results.elements());
}
示例2: quantiles
import cern.jet.stat.Descriptive; //导入方法依赖的package包/类
/**
* Returns the exact quantiles of the specified percentages.
* @param percentages the percentages for which quantiles are to be computed.
* Each percentage must be in the interval <tt>(0.0,1.0]</tt>. <tt>percentages</tt> must be sorted ascending.
* @return the exact quantiles.
*/
public DoubleArrayList quantiles(DoubleArrayList percentages) {
return Descriptive.quantiles(sortedElements_unsafe(),percentages);
}