Random.nextGaussian
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.nd4j.linalg.api.rng.Random.nextGaussian (Showing top 17 results out of 315)

  • Common ways to obtain Random
private void myMethod () {
Random r =
  • Nd4j.getRandom()
  • Smart code suggestions by Codota
}
origin: deeplearning4j/nd4j

/**
 * Random normal using the given rng
 *
 * @param shape the shape of the ndarray
 * @param r     the random generator to use
 * @return
 */
@Override
public INDArray randn(int[] shape, org.nd4j.linalg.api.rng.Random r) {
  return r.nextGaussian(shape);
}
origin: deeplearning4j/nd4j

@Override
public INDArray randn(long[] shape, org.nd4j.linalg.api.rng.Random r) {
  return r.nextGaussian(shape);
}
origin: deeplearning4j/nd4j

/**
 * {@inheritDoc}
 */
@Override
public double sample() {
  if (means != null)
    throw new IllegalStateException("Unable to sample from more than one mean");
  return standardDeviation * random.nextGaussian() + mean;
}
origin: deeplearning4j/nd4j

/**
 * {@inheritDoc}
 */
@Override
public double sample() {
  if (means != null)
    throw new IllegalStateException("Unable to sample from more than one mean");
  return standardDeviation * random.nextGaussian() + mean;
}
origin: deeplearning4j/nd4j

/**
 * {@inheritDoc}
 */
@Override
public double sample() {
  if (means != null)
    throw new IllegalStateException("Unable to sample from more than one mean");
  return standardDeviation * random.nextGaussian() + mean;
}
origin: deeplearning4j/nd4j

/**
 * Random normal using the current time stamp
 * as the seed
 *
 * @param shape the shape of the ndarray
 * @return
 */
@Override
public INDArray randn(char order, int[] shape) {
  return Nd4j.getRandom().nextGaussian(order, shape);
}
origin: deeplearning4j/nd4j

/**
 * Generate a random normal N(0,1) with the specified order and shape
 * @param order   Order of the output array
 * @param rows    the number of rows in the matrix
 * @param columns the number of columns in the matrix
 * @return
 */
@Override
public INDArray randn(char order, long rows, long columns) {
  return Nd4j.getRandom().nextGaussian(order, new long[] {rows, columns});
}
origin: deeplearning4j/nd4j

@Override
public INDArray randn(char order, long[] shape) {
  return Nd4j.getRandom().nextGaussian(order, shape);
}
origin: deeplearning4j/nd4j

  @Override
  public INDArray sample(INDArray ret) {
    if (random.getStatePointer() != null) {
      if (means != null) {
        return Nd4j.getExecutioner().exec(new GaussianDistribution(
            ret, means, standardDeviation), random);
      } else {
        return Nd4j.getExecutioner().exec(new GaussianDistribution(
            ret, mean, standardDeviation), random);
      }
    } else {
      Iterator<long[]> idxIter = new NdIndexIterator(ret.shape()); //For consistent values irrespective of c vs. fortran ordering
      long len = ret.length();
      if (means != null) {
        for (int i = 0; i < len; i++) {
          long[] idx = idxIter.next();
          ret.putScalar(idx, standardDeviation * random.nextGaussian() + means.getDouble(idx));
        }
      } else {
        for (int i = 0; i < len; i++) {
          ret.putScalar(idxIter.next(), standardDeviation * random.nextGaussian() + mean);
        }
      }
      return ret;
    }
  }
}
origin: org.nd4j/nd4j-api

/**
 * Random normal using the given rng
 *
 * @param shape the shape of the ndarray
 * @param r     the random generator to use
 * @return
 */
@Override
public INDArray randn(int[] shape, org.nd4j.linalg.api.rng.Random r) {
  return r.nextGaussian(shape);
}
origin: improbable-research/keanu

public double nextGaussian() {
  return nd4jRandom.nextGaussian();
}
origin: improbable-research/keanu

public double nextGaussian(double mu, double sigma) {
  return nd4jRandom.nextGaussian() * sigma + mu;
}
origin: org.nd4j/nd4j-api

/**
 * {@inheritDoc}
 */
@Override
public double sample() {
  if (means != null)
    throw new IllegalStateException("Unable to sample from more than one mean");
  return standardDeviation * random.nextGaussian() + mean;
}
origin: org.nd4j/nd4j-api

/**
 * Generate a random normal N(0,1) with the specified order and shape
 * @param order   Order of the output array
 * @param rows    the number of rows in the matrix
 * @param columns the number of columns in the matrix
 * @return
 */
@Override
public INDArray randn(char order, int rows, int columns) {
  return Nd4j.getRandom().nextGaussian(order, new int[] {rows, columns});
}
origin: org.nd4j/nd4j-api

/**
 * Random normal using the current time stamp
 * as the seed
 *
 * @param shape the shape of the ndarray
 * @return
 */
@Override
public INDArray randn(char order, int[] shape) {
  return Nd4j.getRandom().nextGaussian(order, shape);
}
origin: improbable-research/keanu

private INDArray doubleNextGaussian(long[] shape) {
  Nd4j.setDataType(bufferType);
  return nd4jRandom.nextGaussian(shape);
}
origin: org.nd4j/nd4j-api

  @Override
  public INDArray sample(int[] shape) {
    if (random.getStatePointer() != null) {
      if (means != null) {
        return Nd4j.getExecutioner().exec(new GaussianDistribution(
                Nd4j.createUninitialized(shape, Nd4j.order()), means, standardDeviation), random);
      } else {
        return Nd4j.getExecutioner().exec(new GaussianDistribution(
                Nd4j.createUninitialized(shape, Nd4j.order()), mean, standardDeviation), random);
      }
    } else {
      INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
      Iterator<int[]> idxIter = new NdIndexIterator(shape); //For consistent values irrespective of c vs. fortran ordering
      int len = ret.length();
      if (means != null) {
        for (int i = 0; i < len; i++) {
          int[] idx = idxIter.next();
          ret.putScalar(idx, standardDeviation * random.nextGaussian() + means.getDouble(idx));
        }
      } else {
        for (int i = 0; i < len; i++) {
          ret.putScalar(idxIter.next(), standardDeviation * random.nextGaussian() + mean);
        }
      }
      return ret;
    }
  }
}
org.nd4j.linalg.api.rngRandomnextGaussian

Javadoc

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

Popular methods of Random

  • setSeed
    Sets the seed of the underlying random number generator using anint seed. Sequences of values genera
  • getStatePointer
    This method returns pointer to RNG state structure. Please note: DefaultRandom implementation return
  • nextDouble
  • nextInt
  • getSeed
    Gets the long seed of the underlying random number generator.
  • getStateBuffer
    This method returns pointer to RNG buffer
  • nextLong
    Returns the next pseudorandom, uniformly distributed long value from this random number generator's
  • nextBoolean
    Returns the next pseudorandom, uniformly distributedboolean value from this random number generator'

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • getContentResolver (Context)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)