当前位置: 首页>>代码示例>>Python>>正文


Python special.ndtr方法代码示例

本文整理汇总了Python中scipy.special.ndtr方法的典型用法代码示例。如果您正苦于以下问题:Python special.ndtr方法的具体用法?Python special.ndtr怎么用?Python special.ndtr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.special的用法示例。


在下文中一共展示了special.ndtr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test_grid_no_log

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def _test_grid_no_log(self, dtype, grid_spec, error_spec):
    with self.test_session():
      grid = _make_grid(dtype, grid_spec)
      actual = sm.ndtr(grid).eval()

      # Basic tests.
      self.assertTrue(np.isfinite(actual).all())
      # On the grid, 0 < cdf(x) < 1.  The grid cannot contain everything due
      # to numerical limitations of cdf.
      self.assertTrue((actual > 0).all())
      self.assertTrue((actual < 1).all())
      _check_strictly_increasing(actual)

      # Versus scipy.
      expected = special.ndtr(grid)
      # Scipy prematurely goes to zero at some places that we don't.  So don't
      # include these in the comparison.
      self.assertAllClose(expected.astype(np.float64)[expected < 0],
                          actual.astype(np.float64)[expected < 0],
                          rtol=error_spec.rtol, atol=error_spec.atol) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:22,代码来源:special_math_test.py

示例2: z_to_p_val

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def z_to_p_val(z_scores):
	# return norm.sf(-z_scores) - 0.5 + 0.5
	return ndtr(z_scores) 
开发者ID:JasonKessler,项目名称:scattertext,代码行数:5,代码来源:LogOddsRatioUninformativeDirichletPrior.py

示例3: get_p_values_from_counts

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def get_p_values_from_counts(self, y_i, y_j):
		return ndtr(self.get_zeta_i_j_given_separate_counts(y_i, y_j)) 
开发者ID:JasonKessler,项目名称:scattertext,代码行数:4,代码来源:LogOddsRatioUninformativeDirichletPrior.py

示例4: integrate_box_1d

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def integrate_box_1d(self, low, high):
        """
        Computes the integral of a 1D pdf between two bounds.

        Parameters
        ----------
        low : scalar
            Lower bound of integration.
        high : scalar
            Upper bound of integration.

        Returns
        -------
        value : scalar
            The result of the integral.

        Raises
        ------
        ValueError
            If the KDE is over more than one dimension.

        """
        if self.d != 1:
            raise ValueError("integrate_box_1d() only handles 1D pdfs")

        stdev = ravel(sqrt(self.covariance))[0]

        normalized_low = ravel((low - self.dataset) / stdev)
        normalized_high = ravel((high - self.dataset) / stdev)

        value = np.mean(special.ndtr(normalized_high) -
                        special.ndtr(normalized_low))
        return value 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:35,代码来源:kde.py

示例5: _norm_cdf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def _norm_cdf(x):
    return sc.ndtr(x) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:4,代码来源:_continuous_distns.py

示例6: _norm_cdf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def _norm_cdf(x):
    return special.ndtr(x) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:4,代码来源:edgeworth.py

示例7: _norm_sf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def _norm_sf(x):
    return special.ndtr(-x) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:4,代码来源:edgeworth.py

示例8: label

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def label(self):
        return 'ndtr' 
开发者ID:chainer,项目名称:chainer,代码行数:4,代码来源:ndtr.py

示例9: forward_cpu

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def forward_cpu(self, x):
        global _ndtr_cpu
        if _ndtr_cpu is None:
            try:
                from scipy import special
                _ndtr_cpu = special.ndtr
            except ImportError:
                warnings.warn(
                    'SciPy is not available. Forward computation of ndtr in'
                    ' CPU can be slow without SciPy.',
                    chainer.warnings.PerformanceWarning)
                _ndtr_cpu = numpy.vectorize(_slow_ndtr_cpu)
        self.retain_inputs((0,))
        return utils.force_array(_ndtr_cpu(x[0]), dtype=x[0].dtype), 
开发者ID:chainer,项目名称:chainer,代码行数:16,代码来源:ndtr.py

示例10: ndtr

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def ndtr(x):
    """Elementwise cumulative distribution function of normal distribution.

    .. note::
       Forward computation in CPU can be slow 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 Ndtr().apply((x,))[0] 
开发者ID:chainer,项目名称:chainer,代码行数:16,代码来源:ndtr.py

示例11: test_ndtr

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def test_ndtr(self):
        assert_mpmath_equal(sc.ndtr,
                            exception_to_nan(lambda z: mpmath.ncdf(z)),
                            [Arg()], n=200) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:6,代码来源:test_mpmath.py

示例12: test_ndtr_complex

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def test_ndtr_complex(self):
        assert_mpmath_equal(sc.ndtr,
                            lambda z: mpmath.erfc(-z/np.sqrt(2.))/2.,
                            [ComplexArg(a=complex(-10000, -10000), b=complex(10000, 10000))], n=400) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:6,代码来源:test_mpmath.py

示例13: _test_grad_finite

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def _test_grad_finite(self, dtype):
    with self.test_session():
      x = tf.Variable([-100., 0., 100.], dtype=dtype)
      output = (sm.log_ndtr(x) if self._use_log else sm.ndtr(x))
      grad_output = tf.gradients(output, x)
      tf.global_variables_initializer().run()
      self.assert_all_true(np.isfinite(output.eval()))
      self.assert_all_true(np.isfinite(grad_output[0].eval())) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:10,代码来源:special_math_test.py

示例14: PI

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def PI(mean, std, max_val, tradeoff):
    return ndtr((mean - max_val - tradeoff)/std) 
开发者ID:modAL-python,项目名称:modAL,代码行数:4,代码来源:acquisition.py

示例15: EI

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import ndtr [as 别名]
def EI(mean, std, max_val, tradeoff):
    z = (mean - max_val - tradeoff) / std
    return (mean - max_val - tradeoff)*ndtr(z) + std*norm.pdf(z) 
开发者ID:modAL-python,项目名称:modAL,代码行数:5,代码来源:acquisition.py


注:本文中的scipy.special.ndtr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。