当前位置: 首页>>代码示例>>Java>>正文


Java TIntIntHashMap.keys方法代码示例

本文整理汇总了Java中gnu.trove.map.hash.TIntIntHashMap.keys方法的典型用法代码示例。如果您正苦于以下问题:Java TIntIntHashMap.keys方法的具体用法?Java TIntIntHashMap.keys怎么用?Java TIntIntHashMap.keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.map.hash.TIntIntHashMap的用法示例。


在下文中一共展示了TIntIntHashMap.keys方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PartialOrder

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
public PartialOrder(DifferenceSets differenceSets) {
	TIntIntHashMap orderMap = new TIntIntHashMap();
	
	for (DifferenceSet differenceSet : differenceSets) {
		// increase the cover count for set columns
		long bitIndex = 0;
		while (bitIndex < differenceSet.getNumberOfColumns()) {
			long currentNextSetBit = differenceSet.nextSetBit(bitIndex);
			if (currentNextSetBit != -1) {
				bitIndex = currentNextSetBit + 1;
				orderMap.putIfAbsent((int) currentNextSetBit, 0);
				orderMap.increment((int) currentNextSetBit);
			} else {
				bitIndex = differenceSet.getNumberOfColumns();
			}
		}
	}
	
	for (Integer index : orderMap.keys()) {
		this.add(new CoverOrder(index, orderMap.get(index)));
	}
	
	Collections.sort(this, Collections.reverseOrder());

}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:26,代码来源:PartialOrder.java

示例2: dumpPathStats

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
private void dumpPathStats(TObjectIntHashMap<String> pathCounts,
		TIntIntHashMap pathlengthCounts) throws IOException {
	
	BufferedWriter writer = new BufferedWriter(new FileWriter("path.info"));
	for (int length : pathlengthCounts.keys()) {
		writer.write(""+length);
		writer.write("\t");
		writer.write(""+pathlengthCounts.get(length));
		writer.write("\n");
	}
	for (Object obj : pathCounts.keys()) {
		String key = (String) obj;
		writer.write(key);
		writer.write("\t");
		writer.write(""+pathCounts.get(key));
		writer.write("\n");
	}
	writer.close();
}
 
开发者ID:taolei87,项目名称:SRLParser,代码行数:20,代码来源:DependencyPipe.java

示例3: recacheStateTopicDistribution

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
private void recacheStateTopicDistribution(int state, TIntIntHashMap topicCounts) {
int[] currentStateTopicCounts = stateTopicCounts[state];
double[][] currentStateCache = topicLogGammaCache[state];
double[] cache;

for (int topic: topicCounts.keys()) {
    cache = currentStateCache[topic];
    
    cache[0] = 0.0;
    for (int i=1; i < cache.length; i++) {
                   cache[i] =
                       cache[ i-1 ] +
                       Math.log( alpha[topic] + i - 1 + 
			  currentStateTopicCounts[topic] );
    }

}

docLogGammaCache[state][0] = 0.0;
for (int i=1; i < docLogGammaCache[state].length; i++) {
               docLogGammaCache[state][i] =
                   docLogGammaCache[state][ i-1 ] +
                   Math.log( alphaSum + i - 1 + 
		      stateTopicTotals[state] );
}
   }
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:27,代码来源:MultinomialHMM.java

示例4: pipe

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
public Instance pipe(Instance instance) {
	
	TIntIntHashMap localCounter = new TIntIntHashMap();

	if (instance.getData() instanceof FeatureSequence) {
			
		FeatureSequence features = (FeatureSequence) instance.getData();

		for (int position = 0; position < features.size(); position++) {
			localCounter.adjustOrPutValue(features.getIndexAtPosition(position), 1, 1);
		}

	}
	else {
		throw new IllegalArgumentException("Looking for a FeatureSequence, found a " + 
										   instance.getData().getClass());
	}

	for (int feature: localCounter.keys()) {
		counter.increment(feature);
	}

	numInstances++;

	return instance;
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:27,代码来源:FeatureDocFreqPipe.java

示例5: norm

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
private double norm(TIntIntHashMap map) {

        int sum = 0;
        for (int i : map.keys()) {
            sum += (Math.pow(map.get(i), 2));
        }

        return Math.sqrt(sum);
    }
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:10,代码来源:UserPathExtractorWorker.java

示例6: toString

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
@Override
public String toString() {
	final String nl = System.getProperty("line.separator");
	final StringBuilder sb = new StringBuilder();

	for (final Entry<String, TIntIntHashMap> e : countResults.entrySet()) {

		// add the id of the timeseries
		sb.append(e.getKey());
		sb.append(": ");

		// add each label
		final TIntIntHashMap vals = e.getValue();
		final int[] keys = vals.keys();
		Arrays.sort(keys);
		for (int i = 0; i < keys.length; i++) {
			if (i > 0) {
				sb.append("; ");
			}

			sb.append(String.format(Locale.US, "%d (%d)",
					vals.get(keys[i]), i));
		}
		sb.append(nl);
	}

	return sb.toString().trim();
}
 
开发者ID:pmeisen,项目名称:dis-timeintervaldataanalyzer,代码行数:29,代码来源:CountValuesCollection.java

示例7: MultinomialHMM

import gnu.trove.map.hash.TIntIntHashMap; //导入方法依赖的package包/类
public MultinomialHMM (int numberOfTopics, String topicsFilename, int numStates) throws IOException {
formatter = NumberFormat.getInstance();
formatter.setMaximumFractionDigits(5);

System.out.println("LDA HMM: " + numberOfTopics);

documentTopics = new TIntObjectHashMap<TIntIntHashMap>();

this.numTopics = numberOfTopics;
this.alphaSum = numberOfTopics;
this.alpha = new double[numberOfTopics];
Arrays.fill(alpha, alphaSum / numTopics);

topicKeys = new String[numTopics];

// This initializes numDocs as well
loadTopicsFromFile(topicsFilename);

documentStates = new int[ numDocs ];
documentSequenceIDs = new int[ numDocs ];

maxTokensPerTopic = new int[ numTopics ];
maxDocLength = 0;

//int[] histogram = new int[380];
//int totalTokens = 0;

for (int doc=0; doc < numDocs; doc++) {
    if (! documentTopics.containsKey(doc)) { continue; }
    
    TIntIntHashMap topicCounts = documentTopics.get(doc);
    
    int count = 0;
    for (int topic: topicCounts.keys()) {
	int topicCount = topicCounts.get(topic);
	//histogram[topicCount]++;
	//totalTokens += topicCount;

	if (topicCount > maxTokensPerTopic[topic]) {
	    maxTokensPerTopic[topic] = topicCount;
	}
	count += topicCount;
    }
    if (count > maxDocLength) {
	maxDocLength = count;
    }
}

/*
double runningTotal = 0.0;
for (int i=337; i >= 0; i--) {
    runningTotal += i * histogram[i];
    System.out.format("%d\t%d\t%.3f\n", i, histogram[i], 
		      runningTotal / totalTokens);
}
*/

this.numStates = numStates; 
this.initialStateCounts = new int[numStates];

topicLogGammaCache = new double[numStates][numTopics][];
for (int state=0; state < numStates; state++) {
    for (int topic=0; topic < numTopics; topic++) {
	topicLogGammaCache[state][topic] = new double[ maxTokensPerTopic[topic] + 1 ];
	//topicLogGammaCache[state][topic] = new double[21];

    }
}
System.out.println( maxDocLength );
docLogGammaCache = new double[numStates][ maxDocLength + 1 ];

   }
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:73,代码来源:MultinomialHMM.java


注:本文中的gnu.trove.map.hash.TIntIntHashMap.keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。