org.apache.mxnet

NDArrayRandomAPIBase

Related Doc: package mxnet

abstract class NDArrayRandomAPIBase extends AnyRef

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NDArrayRandomAPIBase
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new NDArrayRandomAPIBase()

Abstract Value Members

  1. abstract def exponential[T](lam: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from an exponential distribution.
    
    Samples are distributed according to an exponential distribution parametrized by *lambda* (rate).
    
    Example::
    
       exponential(lam=4, shape=(2,2)) = `[ [ 0.0097189 ,  0.08999364],
                                          [ 0.04146638,  0.31715935] ]
    
    
    Defined in src/operator/random/sample_op.cc:L137
    lam

    Lambda parameter (rate) of the exponential distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  2. abstract def exponential_like[T](lam: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from an exponential distribution according to the input array shape.
    
    Samples are distributed according to an exponential distribution parametrized by *lambda* (rate).
    
    Example::
    
       exponential(lam=4, data=ones(2,2)) = `[ [ 0.0097189 ,  0.08999364],
                                             [ 0.04146638,  0.31715935] ]
    
    
    Defined in src/operator/random/sample_op.cc:L242
    lam

    Lambda parameter (rate) of the exponential distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  3. abstract def gamma[T](alpha: Option[T] = None, beta: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a gamma distribution.
    
    Samples are distributed according to a gamma distribution parametrized by *alpha* (shape) and *beta* (scale).
    
    Example::
    
       gamma(alpha=9, beta=0.5, shape=(2,2)) = `[ [ 7.10486984,  3.37695289],
                                                [ 3.91697288,  3.65933681] ]
    
    
    Defined in src/operator/random/sample_op.cc:L125
    alpha

    Alpha parameter (shape) of the gamma distribution.

    beta

    Beta parameter (scale) of the gamma distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  4. abstract def gamma_like[T](alpha: Option[T] = None, beta: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a gamma distribution according to the input array shape.
    
    Samples are distributed according to a gamma distribution parametrized by *alpha* (shape) and *beta* (scale).
    
    Example::
    
       gamma(alpha=9, beta=0.5, data=ones(2,2)) = `[ [ 7.10486984,  3.37695289],
                                                   [ 3.91697288,  3.65933681] ]
    
    
    Defined in src/operator/random/sample_op.cc:L231
    alpha

    Alpha parameter (shape) of the gamma distribution.

    beta

    Beta parameter (scale) of the gamma distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  5. abstract def generalized_negative_binomial[T](mu: Option[T] = None, alpha: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a generalized negative binomial distribution.
    
    Samples are distributed according to a generalized negative binomial distribution parametrized by
    *mu* (mean) and *alpha* (dispersion). *alpha* is defined as *1/k* where *k* is the failure limit of the
    number of unsuccessful experiments (generalized to real numbers).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       generalized_negative_binomial(mu=2.0, alpha=0.3, shape=(2,2)) = `[ [ 2.,  1.],
                                                                        [ 6.,  4.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L179
    mu

    Mean of the negative binomial distribution.

    alpha

    Alpha (dispersion) parameter of the negative binomial distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  6. abstract def generalized_negative_binomial_like[T](mu: Option[T] = None, alpha: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a generalized negative binomial distribution according to the
    input array shape.
    
    Samples are distributed according to a generalized negative binomial distribution parametrized by
    *mu* (mean) and *alpha* (dispersion). *alpha* is defined as *1/k* where *k* is the failure limit of the
    number of unsuccessful experiments (generalized to real numbers).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       generalized_negative_binomial(mu=2.0, alpha=0.3, data=ones(2,2)) = `[ [ 2.,  1.],
                                                                           [ 6.,  4.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L283
    mu

    Mean of the negative binomial distribution.

    alpha

    Alpha (dispersion) parameter of the negative binomial distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  7. abstract def multinomial[T](data: T, shape: Option[Shape] = None, get_prob: Option[Boolean] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Concurrent sampling from multiple multinomial distributions.
    
    *data* is an *n* dimensional array whose last dimension has length *k*, where
    *k* is the number of possible outcomes of each multinomial distribution. This
    operator will draw *shape* samples from each distribution. If shape is empty
    one sample will be drawn from each distribution.
    
    If *get_prob* is true, a second array containing log likelihood of the drawn
    samples will also be returned. This is usually used for reinforcement learning
    where you can provide reward as head gradient for this array to estimate
    gradient.
    
    Note that the input distribution must be normalized, i.e. *data* must sum to
    1 along its last axis.
    
    Examples::
    
       probs = `[ [0, 0.1, 0.2, 0.3, 0.4], [0.4, 0.3, 0.2, 0.1, 0] ]
    
       // Draw a single sample for each distribution
       sample_multinomial(probs) = [3, 0]
    
       // Draw a vector containing two samples for each distribution
       sample_multinomial(probs, shape=(2)) = `[ [4, 2],
                                               [0, 0] ]
    
       // requests log likelihood
       sample_multinomial(probs, get_prob=True) = [2, 1], [0.2, 0.3]
    data

    Distribution probabilities. Must sum to one on the last axis.

    shape

    Shape to be sampled from each random distribution.

    get_prob

    Whether to also return the log probability of sampled result. This is usually used for differentiating through stochastic variables, e.g. in reinforcement learning.

    dtype

    DType of the output in case this can't be inferred.

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  8. abstract def negative_binomial[T](k: Option[T] = None, p: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a negative binomial distribution.
    
    Samples are distributed according to a negative binomial distribution parametrized by
    *k* (limit of unsuccessful experiments) and *p* (failure probability in each experiment).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       negative_binomial(k=3, p=0.4, shape=(2,2)) = `[ [ 4.,  7.],
                                                     [ 2.,  5.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L164
    k

    Limit of unsuccessful experiments.

    p

    Failure probability in each experiment.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  9. abstract def negative_binomial_like[T](k: Option[T] = None, p: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a negative binomial distribution according to the input array shape.
    
    Samples are distributed according to a negative binomial distribution parametrized by
    *k* (limit of unsuccessful experiments) and *p* (failure probability in each experiment).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       negative_binomial(k=3, p=0.4, data=ones(2,2)) = `[ [ 4.,  7.],
                                                        [ 2.,  5.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L267
    k

    Limit of unsuccessful experiments.

    p

    Failure probability in each experiment.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  10. abstract def normal[T](mu: Option[T] = None, sigma: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a normal (Gaussian) distribution.
    
    .. note:: The existing alias ``normal`` is deprecated.
    
    Samples are distributed according to a normal distribution parametrized by *loc* (mean) and *scale*
    (standard deviation).
    
    Example::
    
       normal(loc=0, scale=1, shape=(2,2)) = `[ [ 1.89171135, -1.16881478],
                                              [-1.23474145,  1.55807114] ]
    
    
    Defined in src/operator/random/sample_op.cc:L113
    mu

    Mean of the distribution.

    sigma

    Standard deviation of the distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  11. abstract def normal_like[T](mu: Option[T] = None, sigma: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a normal (Gaussian) distribution according to the input array shape.
    
    Samples are distributed according to a normal distribution parametrized by *loc* (mean) and *scale*
    (standard deviation).
    
    Example::
    
       normal(loc=0, scale=1, data=ones(2,2)) = `[ [ 1.89171135, -1.16881478],
                                                 [-1.23474145,  1.55807114] ]
    
    
    Defined in src/operator/random/sample_op.cc:L220
    mu

    Mean of the distribution.

    sigma

    Standard deviation of the distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  12. abstract def poisson[T](lam: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a Poisson distribution.
    
    Samples are distributed according to a Poisson distribution parametrized by *lambda* (rate).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       poisson(lam=4, shape=(2,2)) = `[ [ 5.,  2.],
                                      [ 4.,  6.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L150
    lam

    Lambda parameter (rate) of the Poisson distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  13. abstract def poisson_like[T](lam: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a Poisson distribution according to the input array shape.
    
    Samples are distributed according to a Poisson distribution parametrized by *lambda* (rate).
    Samples will always be returned as a floating point data type.
    
    Example::
    
       poisson(lam=4, data=ones(2,2)) = `[ [ 5.,  2.],
                                         [ 4.,  6.] ]
    
    
    Defined in src/operator/random/sample_op.cc:L254
    lam

    Lambda parameter (rate) of the Poisson distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  14. abstract def randint[T](low: Any, high: Any, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a discrete uniform distribution.
    
    Samples are uniformly distributed over the half-open interval *[low, high)*
    (includes *low*, but excludes *high*).
    
    Example::
    
       randint(low=0, high=5, shape=(2,2)) = `[ [ 0,  2],
                                              [ 3,  1] ]
    
    
    
    Defined in src/operator/random/sample_op.cc:L193
    low

    Lower bound of the distribution.

    high

    Upper bound of the distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to int32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  15. abstract def uniform[T](low: Option[T] = None, high: Option[T] = None, shape: Option[Shape] = None, ctx: Option[String] = None, dtype: Option[String] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a uniform distribution.
    
    .. note:: The existing alias ``uniform`` is deprecated.
    
    Samples are uniformly distributed over the half-open interval *[low, high)*
    (includes *low*, but excludes *high*).
    
    Example::
    
       uniform(low=0, high=1, shape=(2,2)) = `[ [ 0.60276335,  0.85794562],
                                              [ 0.54488319,  0.84725171] ]
    
    
    
    Defined in src/operator/random/sample_op.cc:L96
    low

    Lower bound of the distribution.

    high

    Upper bound of the distribution.

    shape

    Shape of the output.

    ctx

    Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.

    dtype

    DType of the output in case this can't be inferred. Defaults to float32 if not defined (dtype=None).

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  16. abstract def uniform_like[T](low: Option[T] = None, high: Option[T] = None, data: T, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from a uniform distribution according to the input array shape.
    
    Samples are uniformly distributed over the half-open interval *[low, high)*
    (includes *low*, but excludes *high*).
    
    Example::
    
       uniform(low=0, high=1, data=ones(2,2)) = `[ [ 0.60276335,  0.85794562],
                                                 [ 0.54488319,  0.84725171] ]
    
    
    
    Defined in src/operator/random/sample_op.cc:L208
    low

    Lower bound of the distribution.

    high

    Upper bound of the distribution.

    data

    The input

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()
  17. abstract def unique_zipfian[T](range_max: T, shape: Option[Shape] = None, out: Option[NDArray] = None)(implicit arg0: NDArrayOrScalar[T], arg1: ClassTag[T]): NDArrayFuncReturn

    Draw random samples from an an approximately log-uniform
    or Zipfian distribution without replacement.
    
    This operation takes a 2-D shape `(batch_size, num_sampled)`,
    and randomly generates *num_sampled* samples from the range of integers [0, range_max)
    for each instance in the batch.
    
    The elements in each instance are drawn without replacement from the base distribution.
    The base distribution for this operator is an approximately log-uniform or Zipfian distribution:
    
      P(class) = (log(class + 2) - log(class + 1)) / log(range_max + 1)
    
    Additionaly, it also returns the number of trials used to obtain `num_sampled` samples for
    each instance in the batch.
    
    Example::
    
       samples, trials = _sample_unique_zipfian(750000, shape=(4, 8192))
       unique(samples[0]) = 8192
       unique(samples[3]) = 8192
       trials[0] = 16435
    
    
    
    Defined in src/operator/random/unique_sample_op.cc:L66
    range_max

    The number of possible classes.

    shape

    2-D shape of the output, where shape[0] is the batch size, and shape[1] is the number of candidates to sample for each batch.

    returns

    org.apache.mxnet.NDArrayFuncReturn

    Annotations
    @Experimental()

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  16. def toString(): String

    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped