本文整理匯總了Python中scipy.special.xlog1py方法的典型用法代碼示例。如果您正苦於以下問題:Python special.xlog1py方法的具體用法?Python special.xlog1py怎麽用?Python special.xlog1py使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scipy.special
的用法示例。
在下文中一共展示了special.xlog1py方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _logpdf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def _logpdf(self, x, a, b):
lPx = sc.xlog1py(b - 1.0, -x) + sc.xlogy(a - 1.0, x)
lPx -= sc.betaln(a, b)
return lPx
示例2: _logsf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def _logsf(self, x, c, d):
return sc.xlog1py(-d, x**c)
示例3: _logpmf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def _logpmf(self, x, n, p):
k = floor(x)
combiln = (gamln(n+1) - (gamln(k+1) + gamln(n-k+1)))
return combiln + special.xlogy(k, p) + special.xlog1py(n-k, -p)
示例4: test_xlog1py
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def test_xlog1py():
def xfunc(x, y):
if x == 0 and not np.isnan(y):
return x
else:
return x * np.log1p(y)
z1 = np.asarray([(0,0), (0, np.nan), (0, np.inf), (1.0, 2.0),
(1, 1e-30)], dtype=float)
w1 = np.vectorize(xfunc)(z1[:,0], z1[:,1])
assert_func_equal(special.xlog1py, w1, z1, rtol=1e-13, atol=1e-13)
示例5: pdf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def pdf(self, pX, pR, pP):
"""
PDF for a continuous generalization of NB distribution
"""
gamma_part = gammaln(pR + pX) - gammaln(pX + 1) - gammaln(pR)
return np.exp(gamma_part + (pR * log(pP)) + special.xlog1py(pX, -pP))
示例6: test_xlog1py
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import xlog1py [as 別名]
def test_xlog1py():
def xfunc(x, y):
with np.errstate(invalid='ignore'):
if x == 0 and not np.isnan(y):
return x
else:
return x * np.log1p(y)
z1 = np.asarray([(0,0), (0, np.nan), (0, np.inf), (1.0, 2.0),
(1, 1e-30)], dtype=float)
w1 = np.vectorize(xfunc)(z1[:,0], z1[:,1])
assert_func_equal(special.xlog1py, w1, z1, rtol=1e-13, atol=1e-13)