double weightedProbability(String word) { MutableInt i = features.get(word); return (i == null ? 0.1 : (i.doubleValue() / (double) numDocuments)); }
double majorityClassificationCount = 0; for (Serializable val : classificationsAndCounts.keySet()) { if (minorityClassification == null || classificationsAndCounts.get(val).doubleValue() < minorityClassificationCount) { minorityClassification = val; minorityClassificationCount = classificationsAndCounts.get(val).doubleValue(); if (majorityClassification == null || classificationsAndCounts.get(val).doubleValue() > majorityClassificationCount) { majorityClassification = val; majorityClassificationCount = classificationsAndCounts.get(val).doubleValue(); majorityToMinorityRatio = classificationsAndCounts.get(majorityClassification).doubleValue() / classificationsAndCounts.get(minorityClassification).doubleValue();
@PermitAll @JmxManaged public int getConnectionUsagePercent() { double maxPercentage = 0.0; for (Entry<String,Map<Priority,AccumuloConnectionPool>> entry : pools.entrySet()) { for (Entry<Priority,AccumuloConnectionPool> poolEntry : entry.getValue().entrySet()) { // Don't include ADMIN priority connections when computing a usage percentage if (Priority.ADMIN.equals(poolEntry.getKey())) continue; MutableInt maxActive = new MutableInt(); MutableInt numActive = new MutableInt(); MutableInt numWaiting = new MutableInt(); MutableInt unused = new MutableInt(); poolEntry.getValue().getConnectionPoolStats(maxActive, numActive, unused, unused, numWaiting); double percentage = (numActive.doubleValue() + numWaiting.doubleValue()) / maxActive.doubleValue(); if (percentage > maxPercentage) { maxPercentage = percentage; } } } return (int) (maxPercentage * 100); }