public class SDRandom extends SDOps
SameDiff.random()
Modifier and Type | Method and Description |
---|---|
SDVariable |
bernoulli(double p,
long... shape) |
SDVariable |
bernoulli(double p,
SDVariable shape) |
SDVariable |
bernoulli(String name,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability.
|
SDVariable |
bernoulli(String name,
double p,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability.
|
SDVariable |
binomial(int nTrials,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.
|
SDVariable |
binomial(String name,
int nTrials,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.
|
SDVariable |
exponential(double lambda,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
|
SDVariable |
exponential(String name,
double lambda,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
|
SDVariable |
logNormal(double mean,
double stddev,
long... shape) |
SDVariable |
logNormal(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Log Normal distribution,
i.e.,
log(x) ~ N(mean, stdev) |
SDVariable |
normal(double mean,
double stddev,
long... shape) |
SDVariable |
normal(double mean,
double stddev,
SDVariable shape) |
SDVariable |
normal(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)
See normal(String, double, double, SDVariable) for the equivalent function where the shape is
specified as a long[] instead |
SDVariable |
normal(String name,
double mean,
double stddev,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)
See normal(String, double, double, long...) for the equivalent function where the shape is
specified as a long[] instead |
SDVariable |
normalTruncated(double mean,
double stddev,
long... shape) |
SDVariable |
normalTruncated(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev).
|
SDVariable |
uniform(double min,
double max,
long... shape) |
SDVariable |
uniform(double min,
double max,
SDVariable shape) |
SDVariable |
uniform(double min,
double max,
SDVariable shape,
DataType dataType) |
SDVariable |
uniform(String name,
double min,
double max,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a uniform distribution,
U(min,max)
See uniform(double, double, long...) for the equivalent function where the shape is
specified as a SDVariable instead |
SDVariable |
uniform(String name,
double min,
double max,
SDVariable shape)
As per
uniform(double, double, SDVariable, DataType) but with Float32 output |
SDVariable |
uniform(String name,
double min,
double max,
SDVariable shape,
DataType dataType)
Generate a new random SDVariable, where values are randomly sampled according to a uniform distribution,
U(min,max).
|
f, updateVariableNameAndReference
public SDRandom(SameDiff sd)
public SDVariable bernoulli(double p, SDVariable shape)
bernoulli(String, double, SDVariable)
public SDVariable bernoulli(String name, double p, SDVariable shape)
bernoulli(String, double, long...)
for the equivalent function where the shape is
specified as a long[] insteadname
- Name of the new SDVariablep
- Probability of value 1shape
- Shape of the new random SDVariable, as a 1D arraypublic SDVariable bernoulli(double p, long... shape)
bernoulli(String, double, long...)
public SDVariable bernoulli(String name, double p, long... shape)
bernoulli(String, double, SDVariable)
for the equivalent function where the shape is
specified as a SDVarible insteadname
- Name of the new SDVariablep
- Probability of value 1shape
- Shape of the new random SDVariable, as a 1D arraypublic SDVariable binomial(int nTrials, double p, long... shape)
nTrials
- Number of trials parameter for the binomial distributionp
- Probability of success for each trialshape
- Shape of the new random SDVariable, as a 1D arraypublic SDVariable binomial(String name, int nTrials, double p, long... shape)
name
- Name of the new SDVariablenTrials
- Number of trials parameter for the binomial distributionp
- Probability of success for each trialshape
- Shape of the new random SDVariable, as a 1D arraypublic SDVariable exponential(double lambda, SDVariable shape)
lambda
- Must be > 0shape
- Shape of the outputpublic SDVariable exponential(String name, double lambda, SDVariable shape)
name
- Name of the output variablelambda
- Must be > 0shape
- Shape of the new variablepublic SDVariable logNormal(double mean, double stddev, long... shape)
public SDVariable logNormal(String name, double mean, double stddev, long... shape)
log(x) ~ N(mean, stdev)
name
- Name of the new SDVariablemean
- Mean value for the random arraystddev
- Standard deviation for the random arrayshape
- Shape of the new random SDVariablepublic SDVariable normal(double mean, double stddev, SDVariable shape)
public SDVariable normal(String name, double mean, double stddev, SDVariable shape)
normal(String, double, double, long...)
for the equivalent function where the shape is
specified as a long[] insteadname
- Name of the new SDVariablemean
- Mean value for the random arraystddev
- Standard deviation for the random arrayshape
- Shape of the new random SDVariable, as a 1D arraypublic SDVariable normal(double mean, double stddev, long... shape)
normal(String, double, double, long...)
public SDVariable normal(String name, double mean, double stddev, long... shape)
normal(String, double, double, SDVariable)
for the equivalent function where the shape is
specified as a long[] insteadname
- Name of the new SDVariablemean
- Mean value for the random arraystddev
- Standard deviation for the random arrayshape
- Shape of the new random SDVariablepublic SDVariable normalTruncated(double mean, double stddev, long... shape)
public SDVariable normalTruncated(String name, double mean, double stddev, long... shape)
name
- Name of the new SDVariablemean
- Mean value for the random arraystddev
- Standard deviation for the random arrayshape
- Shape of the new random SDVariablepublic SDVariable uniform(double min, double max, SDVariable shape)
public SDVariable uniform(double min, double max, SDVariable shape, DataType dataType)
public SDVariable uniform(String name, double min, double max, SDVariable shape)
uniform(double, double, SDVariable, DataType)
but with Float32 outputpublic SDVariable uniform(String name, double min, double max, SDVariable shape, DataType dataType)
uniform(double, double, long...)
for the equivalent function where the shape is
specified as a long[] insteadname
- Name of the new SDVariablemin
- Minimum valuemax
- Maximum value. Must satisfy max >= minshape
- Shape of the new random SDVariable, as a 1D arraydataType
- Data type of the output array (if null: Float32 output is returned)public SDVariable uniform(double min, double max, long... shape)
uniform(String, double, double, long...)
public SDVariable uniform(String name, double min, double max, long... shape)
uniform(double, double, long...)
for the equivalent function where the shape is
specified as a SDVariable insteadname
- Name of the new SDVariablemin
- Minimum valuemax
- Maximum value. Must satisfy max >= minshape
- Shape of the new random SDVariableCopyright © 2019. All rights reserved.