@Override public double getValue(int pos) { checkPos(pos); double result = defaultValue; if (data.containsKey(pos)) { result = data.get(pos); } return result; }
@Override public boolean apply(int i) { double value = data.get(i); value = f.apply(value); if (value == defaultValue) { data.removeKey(i); } else { data.put(i, value); } return true; } });
docCount -= 1; double wordProb = candidateTopicWordDistribution.get(topicId).get(wordId); int sumWordCount = candidateTopicWordNumSum.get(topicId);
for (int j = 0; j < indexList.size(); ++j) { int index = indexList.get(j); double prob = topicWordDistributionArray[i].get(index); double cateProb = categoryDistribution.get(index); categoryDistribution.put(index, cateProb + prob); double sum = 0; for (int j = 0; j < indexList.size(); ++j) { sum += categoryDistribution.get(indexList.get(j)); if (categoryDistribution.get(indexList.get(j)) != 0 ) { categoryDistribution.put(indexList.get(j), categoryDistribution.get(indexList.get(j)) / sum ); for (int j = 0; j < indexList.size(); ++j) { int index = indexList.get(j); double count = categoryDistribution.get(index); kvpList.add(new LabelKeyValuePair(this.inverseGlobalWordDict.get(index), count)); categoryDistribution.put( indexList.get(j), categoryDistribution.get(indexList.get(j)) + childCategoryDistribution.get(indexList.get(j)) ); sum = 0; for (int j = 0; j < indexList.size(); ++j) { sum += categoryDistribution.get(indexList.get(j)); if (categoryDistribution.get(indexList.get(j)) != 0 ) { categoryDistribution.put(indexList.get(j), categoryDistribution.get(indexList.get(j)) / sum );
/** * DOCUMENT ME! * * @param node_index DOCUMENT ME! * @param attribute DOCUMENT ME! * * @return DOCUMENT ME! */ public static double getNodeAttributeDoubleValue(int node_index, String attribute) { int att_id = getNodeAttributeID(attribute); if (att_id < 0) return Double.NaN; int att_type = getNodeAttIDToAttTypeMap().get(att_id); if (att_type == DOUBLE_TYPE) { OpenIntObjectHashMap a2v = getNodeAttributeIDToAttributeValuesMap(); OpenIntDoubleHashMap n2v = (OpenIntDoubleHashMap) getNodeAttributeIDToAttributeValuesMap() .get(att_id); if (n2v == null) { CyLogger.getLogger().info("Internal error: Unable to get node attribute id map"); return Double.NaN; } if (n2v.containsKey(node_index)) return n2v.get(node_index); // return ( ( OpenIntDoubleHashMap )getNodeAttributeIDToAttributeValuesMap().get( att_id )).get( node_index ); } return Double.NaN; }
/** * DOCUMENT ME! * * @param node DOCUMENT ME! * @param attribute DOCUMENT ME! * * @return DOCUMENT ME! */ public static double getNodeAttributeDoubleValue(Node node, String attribute) { int att_id = getNodeAttributeID(attribute); if (att_id < 0) return Double.NaN; int node_index = node.getRootGraphIndex(); int att_type = getNodeAttIDToAttTypeMap().get(att_id); if (att_type == DOUBLE_TYPE) { OpenIntObjectHashMap a2v = getNodeAttributeIDToAttributeValuesMap(); OpenIntDoubleHashMap n2v = (OpenIntDoubleHashMap) getNodeAttributeIDToAttributeValuesMap() .get(att_id); if (n2v == null) { CyLogger.getLogger().info("Internal error: Unable to get node attribute id map"); return Double.NaN; } if (n2v.containsKey(node_index)) return n2v.get(node_index); // return ( ( OpenIntDoubleHashMap )getNodeAttributeIDToAttributeValuesMap().get( att_id )).get( node_index ); } return Double.NaN; }