Package cc.mallet.topics
Class RTopicModel
- java.lang.Object
-
- cc.mallet.topics.ParallelTopicModel
-
- cc.mallet.topics.RTopicModel
-
- All Implemented Interfaces:
java.io.Serializable
public class RTopicModel extends ParallelTopicModel
A wrapper for a topic model to be used from the R statistical package through rJava. R does not distinguish between integers and floating point numbers, so many of these methods simply translate doubles to ints.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description InstanceList
instances
-
Fields inherited from class cc.mallet.topics.ParallelTopicModel
alpha, alphabet, alphaSum, beta, betaSum, burninPeriod, data, DEFAULT_BETA, docLengthCounts, formatter, logger, modelFilename, numIterations, numTopics, numTypes, optimizeInterval, printLogLikelihood, randomSeed, saveModelInterval, saveSampleInterval, saveStateInterval, showTopicsInterval, stateFilename, temperingInterval, tokensPerTopic, topicAlphabet, topicBits, topicDocCounts, topicMask, totalTokens, typeTopicCounts, UNASSIGNED_TOPIC, usingSymmetricAlpha, wordsPerTopic
-
-
Constructor Summary
Constructors Constructor Description RTopicModel(double numTopics, double alpha, double beta)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addInstance(InstanceList instances, java.lang.String id, java.lang.String text)
This is a helper method that simplifies class casting from rJava.static void
addInstances(InstanceList instances, java.lang.String[] ids, java.lang.String[] texts)
double[]
getAlpha()
TopicModelDiagnostics
getDiagnostics(double numWords)
java.lang.String[]
getDocumentNames()
java.lang.String[]
getVocabulary()
double[][]
getWordFrequencies()
void
loadDocuments(InstanceList instances)
void
loadDocuments(java.lang.String filename)
void
maximize(double numIterations)
Run iterated conditional modesvoid
setAlphaOptimization(double frequency, double burnin)
void
train(double numIterations)
void
writeState(java.lang.String filename)
-
Methods inherited from class cc.mallet.topics.ParallelTopicModel
addInstances, buildInitialTypeTopicCounts, displayTopWords, estimate, getAlphabet, getData, getDocumentTopics, getInferencer, getNumTopics, getProbEstimator, getSortedWords, getSubCorpusTopicWords, getTokensPerTopic, getTopicAlphabet, getTopicDocuments, getTopicProbabilities, getTopicProbabilities, getTopicWords, getTopWords, getTypeTopicCounts, initializeFromState, maximize, modelLogLikelihood, optimizeAlpha, optimizeBeta, printDenseDocumentTopics, printDocumentTopics, printDocumentTopics, printDocumentTopics, printState, printState, printTopicDocuments, printTopicDocuments, printTopicWordWeights, printTopicWordWeights, printTopWords, printTopWords, printTypeTopicCounts, read, setBurninPeriod, setNumIterations, setNumThreads, setNumTopics, setOptimizeInterval, setRandomSeed, setSaveSerializedModel, setSaveState, setSymmetricAlpha, setTemperingInterval, setTopicDisplay, temperAlpha, topicPhraseXMLReport, topicXMLReport, write
-
-
-
-
Field Detail
-
instances
public InstanceList instances
-
-
Method Detail
-
loadDocuments
public void loadDocuments(java.lang.String filename)
-
loadDocuments
public void loadDocuments(InstanceList instances)
-
addInstance
public static void addInstance(InstanceList instances, java.lang.String id, java.lang.String text)
This is a helper method that simplifies class casting from rJava.
-
addInstances
public static void addInstances(InstanceList instances, java.lang.String[] ids, java.lang.String[] texts)
-
setAlphaOptimization
public void setAlphaOptimization(double frequency, double burnin)
-
train
public void train(double numIterations)
-
maximize
public void maximize(double numIterations)
Run iterated conditional modes
-
getAlpha
public double[] getAlpha()
-
getVocabulary
public java.lang.String[] getVocabulary()
-
getDocumentNames
public java.lang.String[] getDocumentNames()
-
getWordFrequencies
public double[][] getWordFrequencies()
-
getDiagnostics
public TopicModelDiagnostics getDiagnostics(double numWords)
-
writeState
public void writeState(java.lang.String filename)
-
-