//print topic-word matrix, for further IR use
public void printPhi(File f, double threshold) throws IOException{
PrintWriter pw = new PrintWriter(new FileWriter(f));
FeatureCounter[] wordCountsPerTopic = new FeatureCounter[numTopics];
for (int ti = 0; ti < numTopics; ti++) {
wordCountsPerTopic[ti] = new FeatureCounter(alphabet);
}
for (int fi = 0; fi < numTypes; fi++) {
int[] topics = typeTopicCounts[fi].keys();
for (int i = 0; i < topics.length; i++) {
wordCountsPerTopic[topics[i]].increment(fi, typeTopicCounts[fi].get(topics[i]));
}
}
for(int ti = 0; ti < numTopics; ti++){
pw.println("Topic\t" + ti);
FeatureCounter counter = wordCountsPerTopic[ti];
FeatureVector fv = counter.toFeatureVector();
for(int pos = 0; pos < fv.numLocations(); pos++){
int fi = fv.indexAtLocation(pos);
String word = (String) alphabet.lookupObject(fi);
int count = (int) fv.valueAtLocation(pos);
double prob;