# Exponential¶

class paddle.distribution. Exponential ( rate ) [source]

Exponential distribution parameterized by rate.

The probability density function (pdf) is

$f(x; \theta) = \theta e^{- \theta x }, (x \ge 0)$

In the above equation:

• $$rate = \theta$$: is the rate parameter.

Parameters

rate (float|Tensor) – Rate parameter. The value of rate must be positive.

Example

>>> import paddle

>>> print(expon.mean)
[2.])

>>> print(expon.variance)
[4.])

>>> print(expon.entropy())
[1.69314718])

property mean

Mean of exponential distribution.

Returns

mean value.

Return type

Tensor

property variance

Variance of exponential distribution.

Returns

variance value.

Return type

Tensor

sample ( shape=() )

Generate samples of the specified shape.

Parameters

shape (Sequence[int], optional) – Shape of the generated samples.

Returns

Tensor, A tensor with prepended dimensions shape. The data type is float32.

rsample ( shape=() )

Generate reparameterized samples of the specified shape.

Parameters

shape (Sequence[int], optional) – Shape of the generated samples.

Returns

A tensor with prepended dimensions shape. The data type is float32.

Return type

Tensor

prob ( value )

Probability density function evaluated at value.

${ f(x; \theta) = \theta e^{- \theta x}, (x \ge 0 ) }$
Parameters

value (float|Tensor) – Value to be evaluated.

Returns

Probability.

Return type

Tensor

log_prob ( value )

Log probability density function evaluated at value.

Parameters

value (float|Tensor) – Value to be evaluated

Returns

Log probability.

Return type

Tensor

entropy ( )

Entropy of exponential distribution.

Returns

Entropy.

Return type

Tensor

cdf ( value )

Cumulative distribution function(CDF) evaluated at value.

${ cdf(x; \theta) = 1 - e^{- \theta x }, (x \ge 0) }$
Parameters

value (float|Tensor) – Value to be evaluated.

Returns

CDF evaluated at value.

Return type

Tensor

icdf ( value )

Inverse cumulative distribution function(CDF) evaluated at value.

${ icdf(x; \theta) = -\frac{ 1 }{ \theta } ln(1 + x), (x \ge 0) }$
Parameters

value (float|Tensor) – Value to be evaluated.

Returns

CDF evaluated at value.

Return type

Tensor

kl_divergence ( other ) [source]

The KL-divergence between two exponential distributions.

Parameters

other (Exponential) – instance of Exponential.

Returns

kl-divergence between two exponential distributions.

Return type

Tensor

property batch_shape

Returns batch shape of distribution

Returns

batch shape

Return type

Sequence[int]

property event_shape

Returns event shape of distribution

Returns

event shape

Return type

Sequence[int]

probs ( value )

Probability density/mass function.

Note

This method will be deprecated in the future, please use prob instead.