Package cc.mallet.topics
Class LabeledLDA
- java.lang.Object
-
- cc.mallet.topics.LabeledLDA
-
- All Implemented Interfaces:
java.io.Serializable
public class LabeledLDA extends java.lang.Object implements java.io.SerializableLabeledLDA- Author:
- David Mimno
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected doublealphaprotected Alphabetalphabetprotected doublebetaprotected doublebetaSumprotected java.util.ArrayList<TopicAssignment>datastatic doubleDEFAULT_BETAprotected AlphabetlabelAlphabetprotected static java.util.logging.LoggerloggerintnumIterationsprotected intnumTopicsprotected intnumTypesprotected int[]oneDocTopicCountsprotected booleanprintLogLikelihoodprotected RandomsrandomintshowTopicsIntervalprotected int[]tokensPerTopicprotected LabelAlphabettopicAlphabetprotected int[][]typeTopicCountsintwordsPerTopic
-
Constructor Summary
Constructors Constructor Description LabeledLDA(double alpha, double beta)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInstances(InstanceList training)voidestimate()AlphabetgetAlphabet()java.util.ArrayList<TopicAssignment>getData()LabelAlphabetgetTopicAlphabet()int[]getTopicTotals()int[][]getTypeTopicCounts()voidinitializeFromState(java.io.File stateFile)static voidmain(java.lang.String[] args)doublemodelLogLikelihood()static LabeledLDAread(java.io.File f)protected voidsampleTopicsForOneDoc(FeatureSequence tokenSequence, FeatureVector labels, FeatureSequence topicSequence)voidsetNumIterations(int numIterations)voidsetRandomSeed(int seed)voidsetTopicDisplay(int interval, int n)java.lang.StringtopWords(int numWords)voidwrite(java.io.File f)
-
-
-
Field Detail
-
logger
protected static java.util.logging.Logger logger
-
data
protected java.util.ArrayList<TopicAssignment> data
-
alphabet
protected Alphabet alphabet
-
labelAlphabet
protected Alphabet labelAlphabet
-
topicAlphabet
protected LabelAlphabet topicAlphabet
-
numTopics
protected int numTopics
-
numTypes
protected int numTypes
-
alpha
protected double alpha
-
beta
protected double beta
-
betaSum
protected double betaSum
-
DEFAULT_BETA
public static final double DEFAULT_BETA
- See Also:
- Constant Field Values
-
oneDocTopicCounts
protected int[] oneDocTopicCounts
-
typeTopicCounts
protected int[][] typeTopicCounts
-
tokensPerTopic
protected int[] tokensPerTopic
-
numIterations
public int numIterations
-
showTopicsInterval
public int showTopicsInterval
-
wordsPerTopic
public int wordsPerTopic
-
random
protected Randoms random
-
printLogLikelihood
protected boolean printLogLikelihood
-
-
Method Detail
-
getAlphabet
public Alphabet getAlphabet()
-
getTopicAlphabet
public LabelAlphabet getTopicAlphabet()
-
getData
public java.util.ArrayList<TopicAssignment> getData()
-
setTopicDisplay
public void setTopicDisplay(int interval, int n)
-
setRandomSeed
public void setRandomSeed(int seed)
-
setNumIterations
public void setNumIterations(int numIterations)
-
getTypeTopicCounts
public int[][] getTypeTopicCounts()
-
getTopicTotals
public int[] getTopicTotals()
-
addInstances
public void addInstances(InstanceList training)
-
initializeFromState
public void initializeFromState(java.io.File stateFile) throws java.io.IOException- Throws:
java.io.IOException
-
estimate
public void estimate() throws java.io.IOException- Throws:
java.io.IOException
-
sampleTopicsForOneDoc
protected void sampleTopicsForOneDoc(FeatureSequence tokenSequence, FeatureVector labels, FeatureSequence topicSequence)
-
modelLogLikelihood
public double modelLogLikelihood()
-
topWords
public java.lang.String topWords(int numWords)
-
write
public void write(java.io.File f)
-
read
public static LabeledLDA read(java.io.File f) throws java.lang.Exception
- Throws:
java.lang.Exception
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-