义县开展 城市环境集中整治行动

class paddle.distribution. Gumbel ( loc, scale ) [源代码] ?
百度 通用光电认为,广州悦可军玉与中山吉莱德的行为构成不正当竞争,宋某应承担连带责任,随后通用光电作为原告起诉至广东省广州市越秀区人民法院(下称越秀法院),请求法院判令广州悦可军玉、中山吉莱德及宋某(下称三被告)停止侵权,并赔偿经济损失等100万元。

耿贝尔分布

数学公式:

\[F(x; \mu, \beta) = e^{-e^{\frac {-(x-\mu)} {\beta}}}\]

上面数学公式中:

\(loc = \mu\):耿贝尔分布位置参数。

\(scale = \beta\):耿贝尔分布尺度参数。

参数?

  • loc (int|float|Tensor) - 耿贝尔分布位置参数。数据类型为 int、float、Tensor。

  • scale (int|float|Tensor) - 耿贝尔分布尺度参数。数据类型为 int、float、Tensor。

代码示例?

>>> import paddle
>>> from paddle.distribution.gumbel import Gumbel

>>> # Gumbel distributed with loc=0, scale=1
>>> dist = Gumbel(paddle.full([1], 0.0), paddle.full([1], 1.0))

>>> print(dist.sample([2]))
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.40484068],
[3.19400501]])

>>> print(dist.rsample([2]))
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[-0.95093185],
[ 0.32422572]])

>>> value = paddle.full([1], 0.5)
>>> print(dist.prob(value))
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[0.33070430])

>>> print(dist.log_prob(value))
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[-1.10653067])

>>> print(dist.cdf(value))
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[0.54523921])

>>> print(dist.entropy())
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[1.57721567])

属性?

mean?

均值

数学公式:

\[mean = -\gamma\]

上面数学公式中:

\(\gamma\):欧拉常数。

variance?

方差

数学公式:

\[variance = \frac{1}{6}{\pi^2\beta^2}\]

上面数学公式中:

\(scale = \beta\):耿贝尔分布尺度参数。

stddev?

标准差

数学公式:

\[stddev = \frac{1}{\sqrt{6}} {\pi\beta}\]

上面数学公式中:

\(scale = \beta\):耿贝尔分布尺度参数。

方法?

prob(value)?

耿贝尔分布的概率密度函数。

参数

  • value (Tensor|Scalar) - 待计算的值。

数学公式:

\[prob(value) = e^{-e^{\frac {-(value-\mu)} {\beta}}}\]

上面数学公式中:

\(loc = \mu\):耿贝尔分布位置参数。

\(scale = \beta\):耿贝尔分布尺度参数。

返回

  • Tensor - value 在耿贝尔分布下的概率值。

log_prob(value)?

耿贝尔分布的对数概率密度函数。

参数

  • value (Tensor|Scalar) - 待计算的值。

数学公式:

\[log\_prob(value) = log(e^{-e^{\frac {-(value-\mu)} {\beta}}})\]

上面数学公式中:

\(loc = \mu\):耿贝尔分布位置参数。

\(scale = \beta\):耿贝尔分布尺度参数。

返回

  • Tensor - value 在耿贝尔分布下的对数概率值。

cdf(value)?

累积分布函数

参数

  • value (Tensor) - 输入 Tensor。

数学公式:

\[cdf(value) = e^{-e^{\frac {-(value-\mu)} {\beta}}}\]

上面的数学公式中:

\(loc = \mu\):耿贝尔分布位置参数。

\(scale = \beta\):耿贝尔分布尺度参数。

返回

  • Tensor: value 对应 Gumbel 累积分布函数下的值。

entropy(scale)?

耿贝尔分布的信息熵。

参数

  • scale (int|float|Tensor) - 耿贝尔分布的尺度参数。

数学公式:

\[entropy(scale) = ln(\beta) + 1 + γ\]

上面数学公式中:

\(scale = \beta\):耿贝尔分布尺度参数。

\(\gamma\):欧拉常数。

sample(shape=[])?

随机采样,生成指定维度的样本。

参数

  • shape (Sequence[int],可选) - 1 维列表,指定样本的维度。

返回

  • Tensor - 预先设计好维度的样本数据。

rsample(shape=[])?

重参数化采样。

参数

  • shape (Sequence[int],可选) - 1 维列表,指定样本的维度。

返回

  • Tensor - 预先设计好维度的样本数据。