Python scipy.special.xlog1py() Examples

The following are 27 code examples of scipy.special.xlog1py(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scipy.special , or try the search function .
Example #1
Source File: _continuous_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logsf(self, x, c, d):
        return sc.xlog1py(-d, x**c) 
Example #2
Source File: _discrete_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logpmf(self, k, p):
        return special.xlog1py(k - 1, -p) + log(p) 
Example #3
Source File: _discrete_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logpmf(self, x, n, p):
        coeff = gamln(n+x) - gamln(x+1) - gamln(n)
        return coeff + n*log(p) + special.xlog1py(x, -p) 
Example #4
Source File: _discrete_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
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) 
Example #5
Source File: _continuous_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logpdf(self, x, c):
        return _lazywhere((x == x) & (c != 0), (x, c),
                          lambda x, c: -sc.xlog1py(c + 1., c*x) / c,
                          -x) 
Example #6
Source File: _continuous_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logsf(self, x, c, d):
        return sc.xlog1py(-d, x**c) 
Example #7
Source File: _continuous_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logpdf(self, x, c, d):
        return np.log(c) + np.log(d) + sc.xlogy(c - 1, x) + sc.xlog1py(-d-1, x**c) 
Example #8
Source File: _continuous_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _logpdf(self, x, a, b):
        return sc.xlogy(a - 1.0, x) - sc.xlog1py(a + b, x) - sc.betaln(a, b) 
Example #9
Source File: _continuous_distns.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
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 
Example #10
Source File: test_basic.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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) 
Example #11
Source File: _discrete_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logpmf(self, k, p):
        return special.xlog1py(k - 1, -p) + log(p) 
Example #12
Source File: _discrete_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logpmf(self, x, n, p):
        coeff = gamln(n+x) - gamln(x+1) - gamln(n)
        return coeff + n*log(p) + special.xlog1py(x, -p) 
Example #13
Source File: _discrete_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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) 
Example #14
Source File: _continuous_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logpdf(self, x, c):
        return _lazywhere((x == x) & (c != 0), (x, c),
                          lambda x, c: -sc.xlog1py(c + 1., c*x) / c,
                          -x) 
Example #15
Source File: _continuous_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
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 
Example #16
Source File: _continuous_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logpdf(self, x, c, d):
        return np.log(c) + np.log(d) + sc.xlogy(c - 1, x) + sc.xlog1py(-d-1, x**c) 
Example #17
Source File: _continuous_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _logpdf(self, x, a, b):
        return sc.xlogy(a - 1.0, x) - sc.xlog1py(a + b, x) - sc.betaln(a, b) 
Example #18
Source File: _continuous_distns.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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 
Example #19
Source File: viewpoint.py    From HiCExplorer with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #20
Source File: test_basic.py    From Computable with MIT License 5 votes vote down vote up
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) 
Example #21
Source File: _discrete_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logpmf(self, k, p):
        return special.xlog1py(k - 1, -p) + log(p) 
Example #22
Source File: _discrete_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logpmf(self, x, n, p):
        coeff = gamln(n+x) - gamln(x+1) - gamln(n)
        return coeff + n*log(p) + special.xlog1py(x, -p) 
Example #23
Source File: _discrete_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
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) 
Example #24
Source File: _continuous_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logpdf(self, x, c):
        return _lazywhere((x == x) & (c != 0), (x, c),
                          lambda x, c: -sc.xlog1py(c + 1., c*x) / c,
                          -x) 
Example #25
Source File: _continuous_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logsf(self, x, c, d):
        return sc.xlog1py(-d, x**c) 
Example #26
Source File: _continuous_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logpdf(self, x, c, d):
        return np.log(c) + np.log(d) + sc.xlogy(c - 1, x) + sc.xlog1py(-d-1, x**c) 
Example #27
Source File: _continuous_distns.py    From lambda-packs with MIT License 5 votes vote down vote up
def _logpdf(self, x, a, b):
        return sc.xlogy(a - 1.0, x) - sc.xlog1py(a + b, x) - sc.betaln(a, b)