本文整理汇总了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)