Skip to content

Commit

Permalink
【Hackathon No.8】 为 Gumbel 分布添加中文文档。 (#5290)
Browse files Browse the repository at this point in the history
* commit:中文 API 文档

* fix: code style

* fix: code style

* add:cdf for Gumbel_cn.rst

* fix:code style for Gumbel_cn.rst

* fix: code style

Co-authored-by: YuRonan <471254751@qq.com>
  • Loading branch information
dasenCoding and PureNatural authored Oct 17, 2022
1 parent 4e01da2 commit 5e59c02
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 0 deletions.
195 changes: 195 additions & 0 deletions docs/api/paddle/distribution/Gumbel_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
.. _cn_api_distribution_Gumbel:

Gumbel
-------------------------------

.. py:class:: paddle.distribution.Gumbel(loc, scale)
耿贝尔分布

数学公式:

.. math::
F(x; \mu, \beta) = e^{-e^{\frac {-(x-\mu)} {\beta}}}
上面数学公式中:

:math:`loc = \mu`:耿贝尔分布位置参数。

:math:`scale = \beta`:耿贝尔分布尺度参数。


参数
::::::::::::

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

代码示例
::::::::::::

COPY-FROM: paddle.distribution.Gumbel

属性
:::::::::

mean
'''''''''

均值

数学公式:

.. math::
mean = -\gamma
上面数学公式中:

:math:`\gamma`:欧拉常数。

variance
'''''''''

方差

数学公式:

.. math::
variance = \frac{1}{6}{\pi^2\beta^2}
上面数学公式中:

:math:`scale = \beta`:耿贝尔分布尺度参数。

stddev
'''''''''

标准差

数学公式:

.. math::
stddev = \frac{1}{\sqrt{6}} {\pi\beta}
上面数学公式中:

:math:`scale = \beta`:耿贝尔分布尺度参数。


方法
:::::::::

prob(value)
'''''''''
耿贝尔分布的概率密度函数。

**参数**

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

数学公式:

.. math::
prob(value) = e^{-e^{\frac {-(value-\mu)} {\beta}}}
上面数学公式中:

:math:`loc = \mu`:耿贝尔分布位置参数。

:math:`scale = \beta`:耿贝尔分布尺度参数。

**返回**

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

log_prob(value)
'''''''''
耿贝尔分布的对数概率密度函数。

**参数**

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

数学公式:

.. math::
log\_prob(value) = log(e^{-e^{\frac {-(value-\mu)} {\beta}}})
上面数学公式中:

:math:`loc = \mu`:耿贝尔分布位置参数。

:math:`scale = \beta`:耿贝尔分布尺度参数。

**返回**

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

cdf(value)
'''''''''
累积分布函数

**参数**

- **value** (Tensor) - 输入张量。

数学公式:

.. math::
cdf(value) = e^{-e^{\frac {-(value-\mu)} {\beta}}}
上面的数学公式中:

:math:`loc = \mu`:耿贝尔分布位置参数。

:math:`scale = \beta`:耿贝尔分布尺度参数。

**返回**

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

entropy(scale)
'''''''''
耿贝尔分布的信息熵。

**参数**

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

数学公式:

.. math::
entropy(scale) = ln(\beta) + 1 + γ
上面数学公式中:

:math:`scale = \beta`:耿贝尔分布尺度参数。

:math:`\gamma`:欧拉常数。


sample(shape)
'''''''''
随机采样,生成指定维度的样本。

**参数**

- **shape** (list[int]) - 1 维列表,指定样本的维度。

**返回**

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


rsample(shape)
'''''''''
重参数化采样。

**参数**

- **shape** (list[int]) - 1 维列表,指定样本的维度。

**返回**

- **Tensor** - 预先设计好维度的样本数据。
1 change: 1 addition & 0 deletions docs/api/paddle/distribution/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ paddle.distribution 目录下包含飞桨框架支持的随机变量的概率分
" :ref:`TransfomedDistribution <cn_api_paddle_distribution_TransformedDistribution>` ", "TransformedDistribution 概率分布类"
" :ref:`Laplace <cn_api_distribution_Laplace>`", "Laplace 概率分布类"
" :ref:`LogNormal <cn_api_distribution_LogNormal>` ", "LogNormal 概率分布类"
" :ref:`Gumbel <cn_api_distribution_Gumbel>` ", "Gumbel 概率分布类"

.. _about_distribution_transform:

Expand Down

0 comments on commit 5e59c02

Please sign in to comment.