Package org.nd4j.linalg.factory.ops
Class NDRandom
- java.lang.Object
-
- org.nd4j.linalg.factory.ops.NDRandom
-
public class NDRandom extends Object
-
-
Constructor Summary
Constructors Constructor Description NDRandom()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description INDArraybernoulli(double p, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability.INDArraybinomial(int nTrials, double p, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.INDArrayexponential(double lambda, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
Inputs must satisfy the following constraints:
Must be positive: lambda > 0INDArraylogNormal(double mean, double stddev, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
i.e.,log(x) ~ N(mean, stdev)INDArraynormal(double mean, double stddev, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)INDArraynormalTruncated(double mean, double stddev, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev).INDArrayuniform(double min, double max, DataType datatype, long... shape)Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
U(min,max)
-
-
-
Method Detail
-
bernoulli
public INDArray bernoulli(double p, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability. Array values will have value 1 with probability P and value 0 with probability
1-P.- Parameters:
p- Probability of value 1datatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
binomial
public INDArray binomial(int nTrials, double p, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.- Parameters:
nTrials- Number of trials parameter for the binomial distributionp- Probability of success for each trialdatatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
exponential
public INDArray exponential(double lambda, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
Inputs must satisfy the following constraints:
Must be positive: lambda > 0- Parameters:
lambda- lambda parameterdatatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
logNormal
public INDArray logNormal(double mean, double stddev, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
i.e.,log(x) ~ N(mean, stdev)- Parameters:
mean- Mean value for the random arraystddev- Standard deviation for the random arraydatatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
normal
public INDArray normal(double mean, double stddev, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)- Parameters:
mean- Mean value for the random arraystddev- Standard deviation for the random arraydatatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
normalTruncated
public INDArray normalTruncated(double mean, double stddev, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev). However, any values more than 1 standard deviation from the mean are dropped and re-sampled- Parameters:
mean- Mean value for the random arraystddev- Standard deviation for the random arraydatatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
uniform
public INDArray uniform(double min, double max, DataType datatype, long... shape)
Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
U(min,max)- Parameters:
min- Minimum valuemax- Maximum value.datatype- Data type of the output variableshape- Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))- Returns:
- output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
-
-