Package org.apache.mahout.math.jet.random.sampling

Examples of org.apache.mahout.math.jet.random.sampling.RandomSamplingAssistant


    this.N = N;

    if (this.samplingRate <= 1.0) {
      this.samplingAssistant = null;
    } else {
      this.samplingAssistant = new RandomSamplingAssistant(Arithmetic.floor(N / samplingRate), N, generator);
    }

    setUp(b, k);
    this.clear();
  }
View Full Code Here


  /**
   * @param missingInfinities the number of infinities to fill.
   * @param buffer            the buffer into which the infinities shall be filled.
   */
  protected void addInfinities(int missingInfinities, DoubleBuffer buffer) {
    RandomSamplingAssistant oldAssistant = this.samplingAssistant;
    this.samplingAssistant = null; // switch off sampler
    //double[] infinities = new double[missingInfinities];

    boolean even = true;
    for (int i = 0; i < missingInfinities; i++) {
View Full Code Here

    super.clear();
    this.beta = 1.0;
    this.weHadMoreThanOneEmptyBuffer = false;
    //this.setSamplingRate(samplingRate,N);

    RandomSamplingAssistant assist = this.samplingAssistant;
    if (assist != null) {
      this.samplingAssistant =
          new RandomSamplingAssistant(Arithmetic.floor(N / samplingRate), N, assist.getRandomGenerator());
    }
  }
View Full Code Here

    int n = (int) Math.round(size * nonZeroFraction);
    if (n == 0) {
      return matrix;
    }

    RandomSamplingAssistant sampler =
        new RandomSamplingAssistant(n, size,
            new MersenneTwister());
    for (int i = 0; i < size; i++) {
      if (sampler.sampleNextElement()) {
        int row = i / columns;
        int column = i % columns;
        matrix.set(row, column, value);
      }
    }
View Full Code Here

    int n = (int) Math.round(size * nonZeroFraction);
    if (n == 0) {
      return matrix;
    }

    RandomSamplingAssistant sampler =
        new RandomSamplingAssistant(n, size,
            new MersenneTwister());
    for (int i = size; --i >= 0;) {
      if (sampler.sampleNextElement()) {
        matrix.set(i, value);
      }
    }

    return matrix;
View Full Code Here

    int n = (int) Math.round(size * nonZeroFraction);
    if (n == 0) {
      return matrix;
    }

    RandomSamplingAssistant sampler =
        new RandomSamplingAssistant(n, size, RandomUtils.getRandom());
    for (int i = 0; i < size; i++) {
      if (sampler.sampleNextElement()) {
        int row = i / columns;
        int column = i % columns;
        matrix.set(row, column, value);
      }
    }
View Full Code Here

    int n = (int) Math.round(size * nonZeroFraction);
    if (n == 0) {
      return matrix;
    }

    RandomSamplingAssistant sampler =
      new RandomSamplingAssistant(n, size, RandomUtils.getRandom());

    for (int i = size; --i >= 0;) {
      if (sampler.sampleNextElement()) {
        matrix.set(i, value);
      }
    }

    return matrix;
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.jet.random.sampling.RandomSamplingAssistant

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.