Package org.apache.mahout.math.stats

Examples of org.apache.mahout.math.stats.Sampler


  public LDASampler(Matrix model, Random random) {
    this.random = random;
    samplers = new Sampler[model.numRows()];
    for(int i = 0; i < samplers.length; i++) {
      samplers[i] = new Sampler(random, model.viewRow(i));
    }
  }
View Full Code Here


    Preconditions.checkNotNull(topicDistribution);
    Preconditions.checkArgument(numSamples > 0, "numSamples must be positive");
    Preconditions.checkArgument(topicDistribution.size() == samplers.length,
        "topicDistribution must have same cardinality as the sampling model");
    int[] samples = new int[numSamples];
    Sampler topicSampler = new Sampler(random, topicDistribution);
    for(int i = 0; i < numSamples; i++) {
      samples[i] = samplers[topicSampler.sample()].sample();
    }
    return samples;
  }
View Full Code Here

    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));
View Full Code Here

    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));
View Full Code Here

      LDASampler(Matrix model, Random random) {
          this.random = random;
          samplers = new Sampler[model.numRows()];
          for (int i = 0; i < samplers.length; i++) {
              samplers[i] = new Sampler(random, model.viewRow(i));
          }
      }
View Full Code Here

          Preconditions.checkNotNull(topicDistribution);
          Preconditions.checkArgument(numSamples > 0, "numSamples must be positive");
          Preconditions.checkArgument(topicDistribution.size() == samplers.length,
                  "topicDistribution must have same cardinality as the sampling model");
          int[] samples = new int[numSamples];
          Sampler topicSampler = new Sampler(random, topicDistribution);
          for (int i = 0; i < numSamples; i++) {
              samples[i] = samplers[topicSampler.sample()].sample();
          }
          return samples;
      }
View Full Code Here

    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));
View Full Code Here

      public LDASampler(Matrix model, Random random) {
          this.random = random;
          samplers = new Sampler[model.numRows()];
          for (int i = 0; i < samplers.length; i++) {
              samplers[i] = new Sampler(random, model.viewRow(i));
          }
      }
View Full Code Here

          Preconditions.checkNotNull(topicDistribution);
          Preconditions.checkArgument(numSamples > 0, "numSamples must be positive");
          Preconditions.checkArgument(topicDistribution.size() == samplers.length,
                  "topicDistribution must have same cardinality as the sampling model");
          int[] samples = new int[numSamples];
          Sampler topicSampler = new Sampler(random, topicDistribution);
          for (int i = 0; i < numSamples; i++) {
              samples[i] = samplers[topicSampler.sample()].sample();
          }
          return samples;
      }
View Full Code Here

    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));
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.stats.Sampler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.