本文整理了Java中org.apache.commons.math3.stat.descriptive.rank.Percentile.withNaNStrategy()
方法的一些代码示例,展示了Percentile.withNaNStrategy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Percentile.withNaNStrategy()
方法的具体详情如下:
包路径:org.apache.commons.math3.stat.descriptive.rank.Percentile
类名称:Percentile
方法名:withNaNStrategy
[英]Build a new instance similar to the current one except for the NaNStrategy strategy.
This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile).
withEstimationType(estimationType).
withNaNStrategy(nanStrategy).
withKthSelector(kthSelector);
If any of the withXxx method is omitted, the default value for the corresponding customization parameter will be used.
[中]除了NansStrategy策略之外,创建一个与当前实例类似的新实例。
此方法旨在用作fluent type builder模式的一部分。构建微调实例应按以下步骤进行:
Percentile customized = new Percentile(quantile).
withEstimationType(estimationType).
withNaNStrategy(nanStrategy).
withKthSelector(kthSelector);
如果省略了withXxx方法中的任何一个,则将使用相应自定义参数的默认值。
代码示例来源: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);
}
代码示例来源:origin: stanford-futuredata/macrobase
@Override
public void consume(List<Datum> records) {
List<DatumWithNorm> toClassify = new ArrayList<>();
double[] scores = new double[records.size()];
for(int i = 0; i < records.size(); i++) {
Datum d = records.get(i);
DatumWithNorm dwn = new DatumWithNorm(d);
toClassify.add(dwn);
scores[i] = dwn.getNorm();
}
Percentile pCalc = new Percentile().withNaNStrategy(NaNStrategy.MAXIMAL);
pCalc.setData(scores);
double cutoff = pCalc.evaluate(scores, targetPercentile * 100);
log.debug("{} Percentile Cutoff: {}", targetPercentile, cutoff);
log.debug("Median: {}", pCalc.evaluate(50));
log.debug("Max: {}", pCalc.evaluate(100));
for(DatumWithNorm dwn : toClassify) {
results.add(new OutlierClassificationResult(dwn.getDatum(),
dwn.getNorm() >= cutoff || dwn.getNorm().isInfinite()));
}
}
内容来源于网络,如有侵权,请联系作者删除!