scipy.stats.rv_discrete.

entropy#

rv_discrete.entropy(*args, **kwds)[source]#

RV 的微分熵。

參數:
arg1, arg2, arg3,…array_like

分布的形狀參數 (請參閱實例物件的文檔字串以取得更多資訊)。

locarray_like, optional

位置參數 (預設值=0)。

scalearray_like, optional (continuous distributions only).

比例參數 (預設值=1)。

註解

熵的定義基底為 e

>>> import numpy as np
>>> from scipy.stats._distn_infrastructure import rv_discrete
>>> drv = rv_discrete(values=((0, 1), (0.5, 0.5)))
>>> np.allclose(drv.entropy(), np.log(2.0))
True