cc.mallet.topics
Class HierarchicalLDA

java.lang.Object
  extended by cc.mallet.topics.HierarchicalLDA

public class HierarchicalLDA
extends java.lang.Object


Constructor Summary
HierarchicalLDA()
           
 
Method Summary
 void calculateNCRP(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights, cc.mallet.topics.HierarchicalLDA.NCRPNode node, double weight)
           
 void calculateWordLikelihood(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights, cc.mallet.topics.HierarchicalLDA.NCRPNode node, double weight, gnu.trove.TIntIntHashMap[] typeCounts, double[] newTopicWeights, int level, int iteration)
           
 double empiricalLikelihood(int numSamples, InstanceList testing)
          For use with empirical likelihood evaluation: sample a path through the tree, then sample a multinomial over topics in that path, then return a weighted sum of words.
 void estimate(int numIterations)
           
 void initialize(InstanceList instances, InstanceList testing, int numLevels, Randoms random)
           
static void main(java.lang.String[] args)
          This method is primarily for testing purposes.
 void printNode(cc.mallet.topics.HierarchicalLDA.NCRPNode node, int indent)
           
 void printNodes()
           
 void printState()
          Writes the current sampling state to the file specified in stateFile.
 void printState(java.io.PrintWriter out)
          Write a text file describing the current sampling state.
 void propagateTopicWeight(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights, cc.mallet.topics.HierarchicalLDA.NCRPNode node, double weight)
          Propagate a topic weight to a node and all its children.
 void samplePath(int doc, int iteration)
           
 void sampleTopics(int doc)
           
 void setAlpha(double alpha)
           
 void setEta(double eta)
           
 void setGamma(double gamma)
           
 void setProgressDisplay(boolean showProgress)
          This parameter determines whether the sampler outputs shows progress by outputting a character after every iteration.
 void setStateFile(java.lang.String stateFile)
           
 void setTopicDisplay(int interval, int words)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchicalLDA

public HierarchicalLDA()
Method Detail

setAlpha

public void setAlpha(double alpha)

setGamma

public void setGamma(double gamma)

setEta

public void setEta(double eta)

setStateFile

public void setStateFile(java.lang.String stateFile)

setTopicDisplay

public void setTopicDisplay(int interval,
                            int words)

setProgressDisplay

public void setProgressDisplay(boolean showProgress)
This parameter determines whether the sampler outputs shows progress by outputting a character after every iteration.


initialize

public void initialize(InstanceList instances,
                       InstanceList testing,
                       int numLevels,
                       Randoms random)

estimate

public void estimate(int numIterations)

samplePath

public void samplePath(int doc,
                       int iteration)

calculateNCRP

public void calculateNCRP(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights,
                          cc.mallet.topics.HierarchicalLDA.NCRPNode node,
                          double weight)

calculateWordLikelihood

public void calculateWordLikelihood(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights,
                                    cc.mallet.topics.HierarchicalLDA.NCRPNode node,
                                    double weight,
                                    gnu.trove.TIntIntHashMap[] typeCounts,
                                    double[] newTopicWeights,
                                    int level,
                                    int iteration)

propagateTopicWeight

public void propagateTopicWeight(gnu.trove.TObjectDoubleHashMap<cc.mallet.topics.HierarchicalLDA.NCRPNode> nodeWeights,
                                 cc.mallet.topics.HierarchicalLDA.NCRPNode node,
                                 double weight)
Propagate a topic weight to a node and all its children. weight is assumed to be a log.


sampleTopics

public void sampleTopics(int doc)

printState

public void printState()
                throws java.io.IOException,
                       java.io.FileNotFoundException
Writes the current sampling state to the file specified in stateFile.

Throws:
java.io.IOException
java.io.FileNotFoundException

printState

public void printState(java.io.PrintWriter out)
                throws java.io.IOException
Write a text file describing the current sampling state.

Throws:
java.io.IOException

printNodes

public void printNodes()

printNode

public void printNode(cc.mallet.topics.HierarchicalLDA.NCRPNode node,
                      int indent)

empiricalLikelihood

public double empiricalLikelihood(int numSamples,
                                  InstanceList testing)
For use with empirical likelihood evaluation: sample a path through the tree, then sample a multinomial over topics in that path, then return a weighted sum of words.


main

public static void main(java.lang.String[] args)
This method is primarily for testing purposes. The HierarchicalLDATUI class has a more flexible interface for command-line use.