本文整理匯總了Java中org.apache.commons.math3.stat.descriptive.SummaryStatistics.getMean方法的典型用法代碼示例。如果您正苦於以下問題:Java SummaryStatistics.getMean方法的具體用法?Java SummaryStatistics.getMean怎麽用?Java SummaryStatistics.getMean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.stat.descriptive.SummaryStatistics
的用法示例。
在下文中一共展示了SummaryStatistics.getMean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: computeStats
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
private void computeStats() {
SummaryStatistics centroidStats = new SummaryStatistics();
SummaryStatistics edgeStats = new SummaryStatistics();
for (IFeature poi : pois) {
centroidStats.addValue(getDistToCentroid().get(poi));
edgeStats.addValue(getDistToEdge().get(poi));
}
meanDistanceCentroid = centroidStats.getMean();
stdDistanceCentroid = centroidStats.getStandardDeviation();
minDistanceCentroid = centroidStats.getMin();
maxDistanceCentroid = centroidStats.getMax();
meanDistanceEdge = edgeStats.getMean();
stdDistanceEdge = edgeStats.getStandardDeviation();
minDistanceEdge = edgeStats.getMin();
maxDistanceEdge = edgeStats.getMax();
}
示例3: calcClusterMeanInfo
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
private double calcClusterMeanInfo(Set<Integer> members) throws AdeInternalException {
if (members.size() == 1){
return 0;
}
final SummaryStatistics sumS = new SummaryStatistics();
for (int i : members){
for (int j : members) {
if (i <= j){
continue;
}
double v;
v = m_informationMat.get(i, j);
if (!Double.isNaN(v)){
sumS.addValue(v);
}
}
}
final double res = sumS.getMean();
if (Double.isNaN(res)){
return 0;
}
return res;
}
示例4: getSummaryStatisticsForCollection
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* This function will take an aggregated collection of Summary Statistics
* and will generate a derived {@link SummaryStatistic} based on a flag for the
* desired summation. This is particularly helpful for finding out the
* means of the individual statistics of the collection.
* For example, if you wanted to find out the mean of means of the collection
* you would call this function like <p>
* getSummaryStatisticsForCollection(aggregate,1).getMean(); <p>
* Or if you wanted to determine the max number of annotations per
* individual, you could call: <p>
* getSummaryStatisticsForCollection(aggregate,5).getMax(); <p>
* The stat flag should be set to the particular individual statistic that should
* be summarized over.
*
* @param aggregate The aggregated collection of summary statistics
* @param stat Integer flag for the statistic (1:mean ; 2:sum; 3:min; 4:max; 5:N)
* @return {@link SummaryStatistics} of the selected statistic
*/
public SummaryStatistics getSummaryStatisticsForCollection(Collection<SummaryStatistics> aggregate, Stat stat) {
//LOG.info("Computing stats over collection of "+aggregate.size()+" elements ("+stat+"):");
//TODO: turn stat into enum
int x = 0;
//To save memory, I am using SummaryStatistics, which does not store the values,
//but this could be changed to DescriptiveStatistics to see values
//as well as other statistical functions like distributions
SummaryStatistics stats = new SummaryStatistics();
Double v = 0.0;
ArrayList<String> vals = new ArrayList();
for (SummaryStatistics s : aggregate) {
switch (stat) {
case MEAN : v= s.getMean(); stats.addValue(s.getMean()); break;
case SUM : v=s.getSum(); stats.addValue(s.getSum()); break;
case MIN : v=s.getMin(); stats.addValue(s.getMin()); break;
case MAX : v=s.getMax(); stats.addValue(s.getMax()); break;
case N : v= ((int)s.getN())*1.0; stats.addValue(s.getN()); break;
};
//vals.add(v.toString());
};
//LOG.info("vals: "+vals.toString());
return stats;
}
示例5: calculateOverallAnnotationSufficiencyForAttributeSet
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
public double calculateOverallAnnotationSufficiencyForAttributeSet(Set<OWLClass> atts) throws UnknownOWLClassException {
SummaryStatistics stats = computeAttributeSetSimilarityStats(atts);
if ((this.getSummaryStatistics() == null) || Double.isNaN(this.getSummaryStatistics().mean.getMean())) {
LOG.info("Stats have not been computed yet - doing this now");
this.computeSystemStats();
}
// score = mean(atts)/mean(overall) + max(atts)/max(overall) + sum(atts)/mean(sum(overall))
double overall_score = 0.0;
Double mean_score = stats.getMean();
Double max_score = stats.getMax();
Double sum_score = stats.getSum();
if (!(mean_score.isNaN() || max_score.isNaN() || sum_score.isNaN())) {
mean_score = StatUtils.min(new double[]{(mean_score / this.overallSummaryStatsPerIndividual.mean.getMean()),1.0});
max_score = StatUtils.min(new double[]{(max_score / this.overallSummaryStatsPerIndividual.max.getMax()),1.0});
sum_score = StatUtils.min(new double[]{(sum_score / this.overallSummaryStatsPerIndividual.sum.getMean()),1.0});
overall_score = (mean_score + max_score + sum_score) / 3;
}
LOG.info("Overall mean: "+mean_score + " max: "+max_score + " sum:"+sum_score + " combined:"+overall_score);
return overall_score;
}
示例6: getCloudletsTaskTimeCompletionAverage
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Computes the TaskTimeCompletion average for all finished Cloudlets on
* this experiment.
*
* @return the TaskTimeCompletion average
*/
double getCloudletsTaskTimeCompletionAverage() {
SummaryStatistics cloudletTaskTimeCompletion = new SummaryStatistics();
DatacenterBroker broker = getBrokerList().stream()
.findFirst()
.orElse(DatacenterBroker.NULL);
broker.getCloudletFinishedList().stream()
.map(c -> c.getFinishTime() - c.getLastDatacenterArrivalTime())
.forEach(cloudletTaskTimeCompletion::addValue);
taskCompletionTimeSlaContract = getTaskTimeCompletionFromContract(broker);
/* Log.printFormattedLine(
"\t\t\n TaskTimeCompletion simulation: %.2f \n TaskTimeCompletion contrato SLA: %.2f \n",
cloudletTaskTimeCompletion.getMean(), taskCompletionTimeSlaContract);*/
return cloudletTaskTimeCompletion.getMean();
}
開發者ID:manoelcampos,項目名稱:cloudsim-plus,代碼行數:23,代碼來源:CloudletTaskTimeCompletionMinimizationExperiment.java
示例7: initialiseGaussianDistributionForNumericAttribute
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
private Map<Attribute, Map<Double, NormalDistribution>> initialiseGaussianDistributionForNumericAttribute(Instance instanceInfo, ArrayList<Instance> instancesList){
Map<Attribute, Map<Double, NormalDistribution>> numericAttributeClassGaussDistributions = new HashMap<>();
// go through each numeric attibute
for (Attribute attribute : Collections.list(instanceInfo.enumerateAttributes())) {
// check whether the attribute is numeric
if(attribute.isNumeric()){
// for each class label
HashMap<Double, NormalDistribution> classLabelDistribution = new HashMap<>();
for (int classLabelNo = 0; classLabelNo < instanceInfo.numClasses(); classLabelNo++) {
// go through all instance in the dataset to create normal distribution
SummaryStatistics summaryStatistics = new SummaryStatistics();
for (Instance instance : instancesList) {
summaryStatistics.addValue(instance.value(attribute));
}
// create normal distribution for this attribute with corresponding
// class label
NormalDistribution normalDistribution = new NormalDistribution(
summaryStatistics.getMean(),
summaryStatistics.getStandardDeviation());
// map to hold classLabel and distribution
classLabelDistribution.put((double) classLabelNo, normalDistribution);
}
// put it into the map
numericAttributeClassGaussDistributions.put(attribute, classLabelDistribution);
}
}
return numericAttributeClassGaussDistributions;
}
示例8: getSummaryStats
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
public void getSummaryStats(double[] values){
SummaryStatistics stats = new SummaryStatistics();
for( int i = 0; i < values.length; i++) {
stats.addValue(values[i]);
}
double mean = stats.getMean();
double std = stats.getStandardDeviation();
System.out.println(mean + "\t" + std);
}
示例9: spectrogramMeanSd
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* @param spectrogram
* @return double[]{mean, sd}
*/
public static double[] spectrogramMeanSd(List<float[]> spectrogram)
{
SummaryStatistics stat=new SummaryStatistics();
for(float[] spec: spectrogram) for(float v: spec) stat.addValue(v);
return new double[]{stat.getMean(), stat.getStandardDeviation()};
}
示例10: SubGraph
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
public SubGraph(int subGraphId, Collection<Integer> itemIndices, SummaryStatistics summaryStatisticsQ, SummaryStatistics summaryStatisticsArea) {
minInit(subGraphId, itemIndices, (float) summaryStatisticsQ.getMean());
standardDeviationQ = (float) summaryStatisticsQ.getStandardDeviation();
meanArea = (float) summaryStatisticsArea.getMean();
standardDeviationArea = (float) summaryStatisticsArea.getStandardDeviation();
debug();
}
示例11: computeStats
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
private void computeStats() {
SummaryStatistics centroidStats = new SummaryStatistics();
SummaryStatistics edgeStats = new SummaryStatistics();
for (IFeature atm : atms) {
centroidStats.addValue(getDistToCentroid().get(atm));
edgeStats.addValue(getDistToEdge().get(atm));
}
meanDistanceCentroid = centroidStats.getMean();
stdDistanceCentroid = centroidStats.getStandardDeviation();
meanDistanceEdge = edgeStats.getMean();
stdDistanceEdge = edgeStats.getStandardDeviation();
}
示例12: applyGlobalFilter
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Applies a global filter on pitches in S1 and moves all pitches whose salience is bellow a certain
* threshold from S1 to S0. This filter is described in [1], section II-C.
*/
private void applyGlobalFilter() {
SummaryStatistics statistics = new SummaryStatistics();
/* Iteration #1: Gather data to obtain salience statistics. */
for (int t=0; t<this.s1.length; t++) {
for (int i=0; i<this.s1[t].length; i++) {
if (this.s1[t][i] == null) {
continue;
}
statistics.addValue(this.s1[t][i].getSalience());
}
}
/* Iteration #2: Move pitches that are bellow the threshold. */
final double threshold = statistics.getMean() - this.t2 * statistics.getStandardDeviation();
for (int t=0; t<this.s1.length; t++) {
for (int i=0; i<this.s1[t].length; i++) {
if (this.s1[t][i] == null) {
continue;
}
if (this.s1[t][i].getSalience() < threshold) {
this.moveToS0(t,i);
}
}
}
}
示例13: setWeek
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Sets min, max, mean, and deviation for a week
*
* @param week Statistics for the week
*/
public void setWeek(SummaryStatistics week)
{
this.weekMin = week.getMin();
this.weekMax = week.getMax();
this.weekAvg = week.getMean();
this.weekDeviation = week.getStandardDeviation();
}
示例14: setMonth
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Sets min, max, mean, and deviation for a month.
*
* @param month Statistics for the month.
*/
public void setMonth(SummaryStatistics month)
{
this.monthMin = month.getMin();
this.monthMax = month.getMax();
this.monthAvg = month.getMean();
this.monthDeviation = month.getStandardDeviation();
}
示例15: setYear
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //導入方法依賴的package包/類
/**
* Sets min, max, mean, and deviation for a year.
*
* @param year Statistics for the year.
*/
public void setYear(SummaryStatistics year)
{
this.yearMin = year.getMin();
this.yearMax = year.getMax();
this.yearAvg = year.getMean();
this.yearDeviation = year.getStandardDeviation();
}