Example usage for org.apache.mahout.math.stats Sampler Sampler

List of usage examples for org.apache.mahout.math.stats Sampler Sampler

Introduction

In this page you can find the example usage for org.apache.mahout.math.stats Sampler Sampler.

Prototype

public Sampler(Random random) 

Source Link

Usage

From source file:com.elex.dmp.core.TopicModel.java

License:Apache License

public TopicModel(Matrix topicTermCounts, Vector topicSums, double eta, double alpha, String[] dictionary,
        int numThreads, double modelWeight) {
    this.dictionary = dictionary;
    this.topicTermCounts = topicTermCounts;
    this.topicSums = topicSums;
    this.numTopics = topicSums.size();
    this.numTerms = topicTermCounts.numCols();
    this.eta = eta;
    this.alpha = alpha;
    this.sampler = new Sampler(RandomUtils.getRandom());
    this.numThreads = numThreads;
    if (modelWeight != 1) {
        topicSums.assign(Functions.mult(modelWeight));
        for (int x = 0; x < numTopics; x++) {
            topicTermCounts.viewRow(x).assign(Functions.mult(modelWeight));
        }/*from www.ja  va  2 s  .co m*/
    }
    initializeThreadPool();
}