public class ParallelLatentDirichletAllocationVectorGibbsSampler extends LatentDirichletAllocationVectorGibbsSampler implements ParallelAlgorithm
LatentDirichletAllocationVectorGibbsSampler
.
It runs the sampling for the different documents using a thread pool.Modifier and Type | Class and Description |
---|---|
protected class |
ParallelLatentDirichletAllocationVectorGibbsSampler.DocumentSampleTask
A document sampling task
|
LatentDirichletAllocationVectorGibbsSampler.Result
alpha, beta, burnInIterations, DEFAULT_ALPHA, DEFAULT_BETA, DEFAULT_BURN_IN_ITERATIONS, DEFAULT_ITERATIONS_PER_SAMPLE, DEFAULT_MAX_ITERATIONS, DEFAULT_TOPIC_COUNT, documentCount, documentTermCounts, documentTermPairsCounts, documentTerms, documentTopicCount, documentTopicSum, iterationsPerSample, occurrenceTopicAssignments, random, result, sampleCount, termCount, topicCount, topicCumulativeProportions, topicTermCount, topicTermSum
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
ParallelLatentDirichletAllocationVectorGibbsSampler()
Creates a new
ParallelLatentDirichletAllocationVectorGibbsSampler with
default parameters. |
ParallelLatentDirichletAllocationVectorGibbsSampler(int topicCount,
double alpha,
double beta,
int maxIterations,
int burnInIterations,
int iterationsPerSample,
java.util.Random random)
Creates a new
ParallelLatentDirichletAllocationVectorGibbsSampler with
the given parameters. |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
int |
getNumThreads()
Gets the number of threads in the thread pool.
|
java.util.concurrent.ThreadPoolExecutor |
getThreadPool()
Gets the thread pool for the algorithm to use.
|
void |
setThreadPool(java.util.concurrent.ThreadPoolExecutor threadPool)
Sets the thread pool for the algorithm to use.
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
getAlpha, getBeta, getBurnInIterations, getDocumentCount, getIterationsPerSample, getRandom, getResult, getTermCount, getTopicCount, initializeAlgorithm, readParameters, sampleTopic, setAlpha, setBeta, setBurnInIterations, setIterationsPerSample, setRandom, setTopicCount
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public ParallelLatentDirichletAllocationVectorGibbsSampler()
ParallelLatentDirichletAllocationVectorGibbsSampler
with
default parameters.public ParallelLatentDirichletAllocationVectorGibbsSampler(int topicCount, double alpha, double beta, int maxIterations, int burnInIterations, int iterationsPerSample, java.util.Random random)
ParallelLatentDirichletAllocationVectorGibbsSampler
with
the given parameters.topicCount
- The number of topics for the algorithm to create. Must be positive.alpha
- The alpha parameter controlling the Dirichlet distribution for the
document-topic probabilities. It acts as a prior weight assigned to
the document-topic counts. Must be positive.beta
- The beta parameter controlling the Dirichlet distribution for the
topic-term probabilities. It acts as a prior weight assigned to
the topic-term counts.maxIterations
- The maximum number of iterations to run for. Must be positive.burnInIterations
- The number of burn-in iterations for the Markov Chain Monte Carlo
algorithm to run before sampling begins.iterationsPerSample
- The number of iterations to the Markov Chain Monte Carlo algorithm
between samples (after the burn-in iterations).random
- The random number generator to use.protected boolean step()
AbstractAnytimeBatchLearner
step
in class LatentDirichletAllocationVectorGibbsSampler
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class LatentDirichletAllocationVectorGibbsSampler
public java.util.concurrent.ThreadPoolExecutor getThreadPool()
ParallelAlgorithm
getThreadPool
in interface ParallelAlgorithm
public void setThreadPool(java.util.concurrent.ThreadPoolExecutor threadPool)
ParallelAlgorithm
setThreadPool
in interface ParallelAlgorithm
threadPool
- Thread pool used for parallelization.public int getNumThreads()
ParallelAlgorithm
getNumThreads
in interface ParallelAlgorithm