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.Serializable
LabeledLDA- Author:
- David Mimno
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected double
alpha
protected Alphabet
alphabet
protected double
beta
protected double
betaSum
protected java.util.ArrayList<TopicAssignment>
data
static double
DEFAULT_BETA
protected Alphabet
labelAlphabet
protected static java.util.logging.Logger
logger
int
numIterations
protected int
numTopics
protected int
numTypes
protected int[]
oneDocTopicCounts
protected boolean
printLogLikelihood
protected Randoms
random
int
showTopicsInterval
protected int[]
tokensPerTopic
protected LabelAlphabet
topicAlphabet
protected int[][]
typeTopicCounts
int
wordsPerTopic
-
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 void
addInstances(InstanceList training)
void
estimate()
Alphabet
getAlphabet()
java.util.ArrayList<TopicAssignment>
getData()
LabelAlphabet
getTopicAlphabet()
int[]
getTopicTotals()
int[][]
getTypeTopicCounts()
void
initializeFromState(java.io.File stateFile)
static void
main(java.lang.String[] args)
double
modelLogLikelihood()
static LabeledLDA
read(java.io.File f)
protected void
sampleTopicsForOneDoc(FeatureSequence tokenSequence, FeatureVector labels, FeatureSequence topicSequence)
void
setNumIterations(int numIterations)
void
setRandomSeed(int seed)
void
setTopicDisplay(int interval, int n)
java.lang.String
topWords(int numWords)
void
write(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
-
-