You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.probability.distribution.Exponential.rst 5.3 kB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. mindspore.nn.probability.distribution.Exponential
  2. ===================================================
  3. .. py:class:: mindspore.nn.probability.distribution.Exponential(rate=None, seed=None, dtype=mstype.float32, name='Exponential')
  4. 指数分布(Exponential Distribution)。
  5. 连续随机分布,取值范围为所有实数,概率密度函数为
  6. .. math::
  7. f(x, \lambda) = \lambda \exp(-\lambda x).
  8. 其中 :math:`\lambda` 为分别为指数分布的率参数。
  9. **参数:**
  10. - **rate** (int, float, list, numpy.ndarray, Tensor) - 率参数。默认值:None。
  11. - **seed** (int) - 采样时使用的种子。如果为None,则使用全局种子。默认值:None。
  12. - **dtype** (mindspore.dtype) - 事件样例的类型。默认值:mindspore.float32。
  13. - **name** (str) - 分布的名称。默认值:'Exponential'。
  14. .. note::
  15. - `rate` 中的元素必须大于0。
  16. - `dtype` 必须是float,因为指数分布是连续的。
  17. **异常:**
  18. - **ValueError** - `rate` 中元素小于0。
  19. - **TypeError** - `dtype` 不是float的子类。
  20. .. py:method:: rate
  21. :property:
  22. 返回 `rate` 。
  23. **返回:**
  24. Tensor,率参数的值。
  25. .. py:method:: cdf(value, rate)
  26. 在给定值下计算累积分布函数(Cumulatuve Distribution Function, CDF)。
  27. **参数:**
  28. - **value** (Tensor) - 要计算的值。
  29. - **rate** (Tensor) - 分布的率参数。默认值:None。
  30. **返回:**
  31. Tensor,累积分布函数的值。
  32. .. py:method:: cross_entropy(dist, rate_b, rate)
  33. 计算分布a和b之间的交叉熵。
  34. **参数:**
  35. - **dist** (str) - 分布的类型。
  36. - **rate_b** (Tensor) - 对比分布的率参数。
  37. - **rate** (Tensor) - 分布的率参数。默认值:None。
  38. **返回:**
  39. Tensor,交叉熵的值。
  40. .. py:method:: entropy(rate)
  41. 计算熵。
  42. **参数:**
  43. - **rate** (Tensor) - 分布的率参数。默认值:None。
  44. **返回:**
  45. Tensor,熵的值。
  46. .. py:method:: kl_loss(dist, rate_b, rate)
  47. 计算KL散度,即KL(a||b)。
  48. **参数:**
  49. - **dist** (str) - 分布的类型。
  50. - **rate_b** (Tensor) - 对比分布的率参数。
  51. - **rate** (Tensor) - 分布的率参数。默认值:None。
  52. **返回:**
  53. Tensor,KL散度。
  54. .. py:method:: log_cdf(value, rate)
  55. 计算给定值对于的累积分布函数的对数。
  56. **参数:**
  57. - **value** (Tensor) - 要计算的值。
  58. - **rate** (Tensor) - 分布的率参数。默认值:None。
  59. **返回:**
  60. Tensor,累积分布函数的对数。
  61. .. py:method:: log_prob(value, rate)
  62. 计算给定值对应的概率的对数。
  63. **参数:**
  64. - **value** (Tensor) - 要计算的值。
  65. - **rate** (Tensor) - 分布的率参数。默认值:None。
  66. **返回:**
  67. Tensor,累积分布函数的对数。
  68. .. py:method:: log_survival(value, rate)
  69. 计算给定值对应的生存函数的对数。
  70. **参数:**
  71. - **value** (Tensor) - 要计算的值。
  72. - **rate** (Tensor) - 分布的率参数。默认值:None。
  73. **返回:**
  74. Tensor,生存函数的对数。
  75. .. py:method:: mean(rate)
  76. 计算期望。
  77. **参数:**
  78. - **rate** (Tensor) - 分布的率参数。默认值:None。
  79. **返回:**
  80. Tensor,概率分布的期望。
  81. .. py:method:: mode(rate)
  82. 计算众数。
  83. **参数:**
  84. - **rate** (Tensor) - 分布的率参数。默认值:None。
  85. **返回:**
  86. Tensor,概率分布的众数。
  87. .. py:method:: prob(value, rate)
  88. 计算给定值下的概率。对于连续是计算概率密度函数(Probability Density Function)。
  89. **参数:**
  90. - **value** (Tensor) - 要计算的值。
  91. - **rate** (Tensor) - 分布的率参数。默认值:None。
  92. **返回:**
  93. Tensor,概率值。
  94. .. py:method:: sample(shape, rate)
  95. 采样函数。
  96. **参数:**
  97. - **shape** (tuple) - 样本的shape。
  98. - **rate** (Tensor) - 分布的率参数。默认值:None。
  99. **返回:**
  100. Tensor,根据概率分布采样的样本。
  101. .. py:method:: sd(rate)
  102. 计算标准差。
  103. **参数:**
  104. - **rate** (Tensor) - 分布的率参数。默认值:None。
  105. **返回:**
  106. Tensor,概率分布的标准差。
  107. .. py:method:: survival_function(value, rate)
  108. 计算给定值对应的生存函数。
  109. **参数:**
  110. - **value** (Tensor) - 要计算的值。
  111. - **rate** (Tensor) - 分布的率参数。默认值:None。
  112. **返回:**
  113. Tensor,生存函数的值。
  114. .. py:method:: var(rate)
  115. 计算方差。
  116. **参数:**
  117. - **rate** (Tensor) - 分布的率参数。默认值:None。
  118. **返回:**
  119. Tensor,概率分布的方差。