本文整理匯總了Java中org.apache.commons.math3.stat.descriptive.SummaryStatistics.getGeometricMean方法的典型用法代碼示例。如果您正苦於以下問題:Java SummaryStatistics.getGeometricMean方法的具體用法?Java SummaryStatistics.getGeometricMean怎麽用?Java SummaryStatistics.getGeometricMean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.stat.descriptive.SummaryStatistics
的用法示例。
在下文中一共展示了SummaryStatistics.getGeometricMean方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStats
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
private static Stats getStats(FloatColumn values, SummaryStatistics summaryStatistics) {
Stats stats = new Stats("Column: " + values.name());
stats.min = (float) summaryStatistics.getMin();
stats.max = (float) summaryStatistics.getMax();
stats.n = summaryStatistics.getN();
stats.sum = summaryStatistics.getSum();
stats.variance = summaryStatistics.getVariance();
stats.populationVariance = summaryStatistics.getPopulationVariance();
stats.quadraticMean = summaryStatistics.getQuadraticMean();
stats.geometricMean = summaryStatistics.getGeometricMean();
stats.mean = summaryStatistics.getMean();
stats.standardDeviation = summaryStatistics.getStandardDeviation();
stats.sumOfLogs = summaryStatistics.getSumOfLogs();
stats.sumOfSquares = summaryStatistics.getSumsq();
stats.secondMoment = summaryStatistics.getSecondMoment();
return stats;
}
示例2: getFeatures
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Returns a list of feature vectors given a SegmentContainer.
*
* @param segment SegmentContainer for which to calculate the feature vectors.
* @return List of HPCP Shingle feature vectors.
*/
private List<float[]> getFeatures(SegmentContainer segment) {
/* Create STFT; If this fails, return empty list. */
Pair<Integer,Integer> parameters = FFTUtil.parametersForDuration(segment.getSamplingrate(), WINDOW_SIZE);
STFT stft = segment.getSTFT(parameters.first,(parameters.first - 2*parameters.second)/2, parameters.second, new HanningWindow());
if (stft == null) {
return new ArrayList<>();
}
HPCP hpcps = new HPCP(this.resolution, this.min_frequency, this.max_frequency);
hpcps.addContribution(stft);
int vectors = Math.max(hpcps.size() - SHINGLE_SIZE, 1);
final SummaryStatistics statistics = new SummaryStatistics();
List<Pair<Double, float[]>> features = new ArrayList<>(vectors);
for (int n = 0; n < vectors; n++) {
Pair<Double, float[]> feature = this.getHPCPShingle(hpcps, n);
features.add(feature);
statistics.addValue(feature.first);
}
final double threshold = 0.25*statistics.getGeometricMean();
return features.stream().filter(f -> (f.first > threshold)).map(f -> f.second).collect(Collectors.toList());
}