org.apache.mahout.clustering.lda
Class LDASampler

java.lang.Object
  extended by org.apache.mahout.clustering.lda.LDASampler

public class LDASampler
extends Object

Takes in a Matrix of topic distributions (such as generated by LDADriver, CVB0Driver or InMemoryCollapsedVariationalBayes0, and constructs a set of samplers over this distribution, which may be sampled from by providing a distribution over topics, and a number of samples desired


Constructor Summary
LDASampler(Matrix model, Random random)
           
 
Method Summary
 int[] sample(Vector topicDistribution, int numSamples)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDASampler

public LDASampler(Matrix model,
                  Random random)
Method Detail

sample

public int[] sample(Vector topicDistribution,
                    int numSamples)
Parameters:
topicDistribution - vector of p(topicId) for all topicId < model.numTopics()
numSamples - the number of times to sample (with replacement) from the model
Returns:
array of length numSamples, with each entry being a sample from the model. There may be repeats


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.