本文整理汇总了Python中scipy.special.ndtri方法的典型用法代码示例。如果您正苦于以下问题:Python special.ndtri方法的具体用法?Python special.ndtri怎么用?Python special.ndtri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.special
的用法示例。
在下文中一共展示了special.ndtri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _norm_ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _norm_ppf(q):
return sc.ndtri(q)
示例2: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, a):
return 1.0/np.asarray(a-sc.ndtri(q*_norm_cdf(a)))
示例3: _ndtri_cpu
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ndtri_cpu(x, dtype):
from scipy import special
return numpy.vectorize(special.ndtri, otypes=[dtype])(x)
示例4: label
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def label(self):
return 'ndtri'
示例5: forward_cpu
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def forward_cpu(self, x):
if not available_cpu:
raise ImportError('SciPy is not available. Forward computation'
' of ndtri in CPU can not be done.' +
str(_import_error))
self.retain_outputs((0,))
return utils.force_array(special.ndtri(x[0]), dtype=x[0].dtype),
示例6: ndtri
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def ndtri(x):
"""Elementwise inverse function of ndtr.
.. note::
Forward computation in CPU can not be done if
`SciPy <https://www.scipy.org/>`_ is not available.
Args:
x (:class:`~chainer.Variable` or :ref:`ndarray`): Input variable.
Returns:
~chainer.Variable: Output variable.
"""
return Ndtri().apply((x,))[0]
示例7: p_to_z
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def p_to_z(p, tail='two'):
"""Convert p-values to (unsigned) z-values.
Parameters
----------
p : array_like
P-values
tail : {'one', 'two'}, optional
Whether p-values come from one-tailed or two-tailed test. Default is
'two'.
Returns
-------
z : array_like
Z-statistics (unsigned)
"""
eps = np.spacing(1)
p = np.array(p)
p[p < eps] = eps
if tail == 'two':
z = ndtri(1 - (p / 2))
z = np.array(z)
elif tail == 'one':
z = ndtri(1 - p)
z = np.array(z)
z[z < 0] = 0
else:
raise ValueError('Argument "tail" must be one of ["one", "two"]')
if z.shape == ():
z = z[()]
return z
示例8: setUp
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def setUp(self):
np.random.seed(1983)
shape = (2, 3)
self.mu = np.random.normal(size=shape)
self.sig = np.square(np.random.normal(size=shape))
self.obs = np.random.normal(loc=self.mu, scale=self.sig, size=shape)
n = 1000
q = np.linspace(0. + 0.5 / n, 1. - 0.5 / n, n)
# convert to the corresponding normal deviates
normppf = special.ndtri
z = normppf(q)
forecasts = z.reshape(-1, 1, 1) * self.sig + self.mu
self.expected = crps_ensemble(self.obs, forecasts, axis=0)
示例9: _cdf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _cdf(self, x, C, Ci):
out = special.ndtr(numpy.dot(Ci, special.ndtri(x)))
return out
示例10: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, C, Ci):
out = special.ndtr(numpy.dot(C, special.ndtri(q)))
return out
示例11: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, c):
tmp = c*special.ndtri(q)
return 0.25*(tmp + numpy.sqrt(tmp**2 + 4))**2
示例12: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q):
val = special.ndtri(1-q/2.0)
return 1.0/(val*val)
示例13: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, c):
return -special.ndtri(pow(1-q, 1./c))
示例14: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, a, b, mu, sigma):
fa = special.ndtr((a-mu)/sigma)
fb = special.ndtr((b-mu)/sigma)
return special.ndtri(q*(fb-fa) + fa)*sigma + mu
示例15: _ppf
# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtri [as 别名]
def _ppf(self, q, C, Ci, loc):
return (numpy.dot(C, special.ndtri(q)).T+loc.T).T