本文整理汇总了Java中org.apache.commons.math.stat.descriptive.DescriptiveStatistics.getSum方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveStatistics.getSum方法的具体用法?Java DescriptiveStatistics.getSum怎么用?Java DescriptiveStatistics.getSum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.stat.descriptive.DescriptiveStatistics
的用法示例。
在下文中一共展示了DescriptiveStatistics.getSum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFeatureObject
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public Feature buildFeatureObject(DescriptiveStatistics summary,String name){
double geometricMean = summary.getGeometricMean();
double kurtosis = summary.getKurtosis();
double max = summary.getMax();
double mean = summary.getMean();
double min = summary.getMin();
double skewness = summary.getSkewness();
double standardDeviation = summary.getStandardDeviation();
double sum = summary.getSum();
double sumsq = summary.getSumsq();
double variance = summary.getVariance();
double[] values = summary.getValues();
Feature feature=new Feature(name, name, null, mean, variance, skewness);
LOG.log(Level.INFO, summary.toString());
return feature;
}
示例2: getBin_spectrum
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public double[] getBin_spectrum(int shift) {
ArrayList<Double> bin_spec_al = new ArrayList<Double>();
double binSize = (fragment_tolerance * 2),
upperLimit = max_value + 0.00001;
for (double lowerLimit = min_value; lowerLimit < upperLimit; lowerLimit = lowerLimit + binSize) {
double tmp_intensity_bin = 0;
DescriptiveStatistics obj = new DescriptiveStatistics();
for (Peak p : peakList) {
double mz = p.getMz() + shift;
if (mz >= lowerLimit && mz < lowerLimit + binSize) {
obj.addValue(p.intensity);
}
}
if (obj.getN() > 0) {
if (intensities_sum_or_mean_or_median == 0) {
tmp_intensity_bin = obj.getSum();
} else if (intensities_sum_or_mean_or_median == 1) {
tmp_intensity_bin = obj.getMean();
} else if (intensities_sum_or_mean_or_median == 2) {
tmp_intensity_bin = obj.getPercentile(50);
}
}
// put every bin_pectrum
bin_spec_al.add(tmp_intensity_bin);
}
// convert an arraylist to double array
// initiate size of array
bin_size = bin_spec_al.size();
double[] bin_spectrum = new double[bin_spec_al.size()];
for (int i = 0; i < bin_spec_al.size(); i++) {
bin_spectrum[i] = bin_spec_al.get(i);
}
return bin_spectrum;
}
示例3: costFromStats
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
/**
* Function to compute a scaled cost using {@link DescriptiveStatistics}. It
* assumes that this is a zero sum set of costs. It assumes that the worst case
* possible is all of the elements in one region server and the rest having 0.
*
* @param stats the costs
* @return a scaled set of costs.
*/
double costFromStats(DescriptiveStatistics stats) {
double totalCost = 0;
double mean = stats.getMean();
//Compute max as if all region servers had 0 and one had the sum of all costs. This must be
// a zero sum cost for this to make sense.
double max = ((stats.getN() - 1) * stats.getMean()) + (stats.getSum() - stats.getMean());
for (double n : stats.getValues()) {
totalCost += Math.abs(mean - n);
}
return scale(0, max, totalCost);
}
示例4: prepareBinSpectra
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private ArrayList<double[]> prepareBinSpectra() {
// first prepare bin-spectrum to be filled with zero
int size = (2 * correctionFactor) + 1;
ArrayList<double[]> shiftedSpectra = new ArrayList<double[]>(size);
for (int i = 0; i < size; i++) {
double[] shiftedSpectrum = new double[bin_size];
shiftedSpectra.add(shiftedSpectrum);
}
// now fill each bin spectrum with correct mz values.
double binSize = (fragment_tolerance * 2),
upperLimit = max_value + 0.00001;
int current_index = 0;
for (double lowerLimit = min_value + correctionFactor; lowerLimit < upperLimit - correctionFactor; lowerLimit = lowerLimit + binSize) {
double tmp_intensity_bin = 0;
DescriptiveStatistics obj = new DescriptiveStatistics();
for (Peak p : peakList) {
double mz = p.getMz();
if (mz >= lowerLimit && mz < lowerLimit + binSize) {
obj.addValue(p.intensity);
}
}
if (obj.getN() > 0) {
if (intensities_sum_or_mean_or_median == 0) {
tmp_intensity_bin = obj.getSum();
} else if (intensities_sum_or_mean_or_median == 1) {
tmp_intensity_bin = obj.getMean();
} else if (intensities_sum_or_mean_or_median == 2) {
tmp_intensity_bin = obj.getPercentile(50);
}
}
// put every bin_pectrum
int filling_index = current_index;
// check every bin spectrum
for (double[] shifted : shiftedSpectra) {
shifted[filling_index] = tmp_intensity_bin;
filling_index++;
}
current_index++;
}
return shiftedSpectra;
}