本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.DescriptiveStatistics.getN方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveStatistics.getN方法的具体用法?Java DescriptiveStatistics.getN怎么用?Java DescriptiveStatistics.getN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
的用法示例。
在下文中一共展示了DescriptiveStatistics.getN方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: phi
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
/**
* Compute phi for the specified node id.
* @param nodeId node id
* @return phi value
*/
public double phi(NodeId nodeId) {
checkNotNull(nodeId, "NodeId must not be null");
if (!states.containsKey(nodeId)) {
return bootstrapPhiValue;
}
History nodeState = states.get(nodeId);
synchronized (nodeState) {
long latestHeartbeat = nodeState.latestHeartbeatTime();
DescriptiveStatistics samples = nodeState.samples();
if (latestHeartbeat == -1 || samples.getN() < minSamples) {
return 0.0;
}
return computePhi(samples, latestHeartbeat, System.currentTimeMillis());
}
}
示例2: computePhi
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private double computePhi(DescriptiveStatistics samples, long tLast, long tNow) {
long size = samples.getN();
long t = tNow - tLast;
return (size > 0)
? phiFactor * t / samples.getMean()
: bootstrapPhiValue;
}
示例3: collectData
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public void collectData()
{
collectPopulationData();
List<DescriptiveStatistics> allTdata = collectMoreTolData();
DescriptiveStatistics tolstats = allTdata.get(0);
DescriptiveStatistics ntolstats = allTdata.get(1);
DescriptiveStatistics mtolstats = allTdata.get(2);
double morans = calculateMoransI(meanBlue);
double moranTol = calculateMoransT(tolstats.getMean());
mC = morans;
mT = moranTol;
//print("<<collectData>> morans is " + morans + ", moranTol is " + moranTol);
String moranStr = "" + morans;
String moranTolStr = "" + moranTol;
String globalHappyStr = "" + globalHappiness;
String globalBlueHappy = "" + globalHappinessB;
String globalGreenHappy = "" + globalHappinessG;
String numAgentStr = "" + allAgents.size();
String totalMoveStr = String.valueOf(globalMoveCounter);
String numblue = String.valueOf(population[0]);
String numgreen = String.valueOf(population[1]);
String changedMindStr = "" + changedMind;
String tolN = "" + tolstats.getN();
String tolmean = "" + tolstats.getMean();
String tolvar = "" + tolstats.getVariance();
String tolstdDev = "" + tolstats.getStandardDeviation();
String tolKurt = "" + tolstats.getKurtosis();
String tolSkew = "" + tolstats.getSkewness();
String ntolN = "" + ntolstats.getN();
String ntolmean = "" + ntolstats.getMean();
String ntolvar = "" + ntolstats.getVariance();
String ntolstdDev = "" + ntolstats.getStandardDeviation();
String ntolKurt = "" + ntolstats.getKurtosis();
String ntolSkew = "" + ntolstats.getSkewness();
String mtolN = "" + mtolstats.getN();
String mtolmean = "" + mtolstats.getMean();
String mtolvar = "" + mtolstats.getVariance();
String mtolstdDev = "" + mtolstats.getStandardDeviation();
String mtolKurt = "" + mtolstats.getKurtosis();
String mtolSkew = "" + mtolstats.getSkewness();
String theString[] = null;
theString = new String[] { moranStr, moranTolStr, totalMoveStr, globalHappyStr, globalBlueHappy, globalGreenHappy, numAgentStr, numblue, numgreen, changedMindStr, tolN, tolmean, tolvar,
tolstdDev, tolKurt, tolSkew, ntolN, ntolmean, ntolvar, ntolstdDev, ntolKurt, ntolSkew, mtolN, mtolmean, mtolvar, mtolstdDev, mtolKurt, mtolSkew };
writer.writeNext(theString);
}
示例4: computeConfidenceInterval
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
private double computeConfidenceInterval(DescriptiveStatistics statistics, double significance)
{
TDistribution tDist = new TDistribution(statistics.getN() - 1);
double a = tDist.inverseCumulativeProbability(1.0 - significance / 2);
return a * statistics.getStandardDeviation() / Math.sqrt(statistics.getN());
}
示例5: getN
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public int getN(final String feature) {
final DescriptiveStatistics stat = stats.get(feature);
return (int) ((stat == null ? 0 : stat.getN()) + getNull(feature));
}