Python scipy.special.log1p() Examples
The following are 30
code examples of scipy.special.log1p().
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 | 6 votes |
def _ppf(self, q, h, k): condlist = [np.logical_and(h != 0, k != 0), np.logical_and(h == 0, k != 0), np.logical_and(h != 0, k == 0), np.logical_and(h == 0, k == 0)] def f0(q, h, k): return 1.0/k*(1.0 - ((1.0 - (q**h))/h)**k) def f1(q, h, k): return 1.0/k*(1.0 - (-np.log(q))**k) def f2(q, h, k): '''ppf = -np.log((1.0 - (q**h))/h) ''' return -sc.log1p(-(q**h)) + np.log(h) def f3(q, h, k): return -np.log(-np.log(q)) return _lazyselect(condlist, [f0, f1, f2, f3], [q, h, k], default=np.nan)
Example #2
Source File: _continuous_distns.py From lambda-packs with MIT License | 6 votes |
def _ppf(self, q, h, k): condlist = [np.logical_and(h != 0, k != 0), np.logical_and(h == 0, k != 0), np.logical_and(h != 0, k == 0), np.logical_and(h == 0, k == 0)] def f0(q, h, k): return 1.0/k*(1.0 - ((1.0 - (q**h))/h)**k) def f1(q, h, k): return 1.0/k*(1.0 - (-np.log(q))**k) def f2(q, h, k): '''ppf = -np.log((1.0 - (q**h))/h) ''' return -sc.log1p(-(q**h)) + np.log(h) def f3(q, h, k): return -np.log(-np.log(q)) return _lazyselect(condlist, [f0, f1, f2, f3], [q, h, k], default=np.nan)
Example #3
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q, c): return sc.expm1(-sc.log1p(-q)/c)
Example #4
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _logcdf(self, x, c, d): return sc.log1p(-(1 + x**c)**(-d))
Example #5
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _logpdf(self, x, c): cx = _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: c*x, 0.0) logex2 = sc.log1p(-cx) logpex2 = self._loglogcdf(x, c) pex2 = np.exp(logpex2) # Handle special cases np.putmask(logpex2, (c == 0) & (x == -np.inf), 0.0) logpdf = np.where((cx == 1) | (cx == -np.inf), -np.inf, -pex2+logpex2-logex2) np.putmask(logpdf, (c == 1) & (x == 1), 0.0) return logpdf
Example #6
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _isf(self, q, c): x = -np.log(-sc.log1p(-q)) return _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: -sc.expm1(-c * x) / c, x)
Example #7
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _loglogcdf(self, x, c): return _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: sc.log1p(-c*x)/c, -x)
Example #8
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _ppf(self, q, b): return pow(sc.log1p(-sc.log1p(-q)), 1.0/b)
Example #9
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _isf(self, x, b): return (sc.log1p(-np.log(x)))**(1./b)
Example #10
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _ppf(self, q, a, c): return (-sc.log1p(-q**(1.0/a)))**np.asarray(1.0/c)
Example #11
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _ppf(self, q, c, d): # The following is an implementation of # ((1 - q)**(-1.0/d) - 1)**(1.0/c) # that does a better job handling small values of q. return sc.expm1(-1/d * sc.log1p(-q))**(1/c)
Example #12
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def _ppf(self, q, c): return pow(-sc.log1p(-q), 1.0/c)
Example #13
Source File: _discrete_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _pmf(self, k, p): # logser.pmf(k) = - p**k / (k*log(1-p)) return -np.power(p, k) * 1.0 / k / special.log1p(-p)
Example #14
Source File: _discrete_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logsf(self, x, p): k = floor(x) return k*log1p(-p)
Example #15
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q, b): return -sc.log1p(q*sc.expm1(-b))
Example #16
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q): return np.sqrt(-2 * sc.log1p(-q))
Example #17
Source File: _discrete_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q, lambda_): vals = ceil(-1.0/lambda_ * log1p(-q)-1) vals1 = (vals-1).clip(self.a, np.inf) temp = self._cdf(vals1, lambda_) return np.where(temp >= q, vals1, vals)
Example #18
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logsf(self, x, c): return -c*sc.log1p(x)
Example #19
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _sf(self, x, c): return np.exp(-c*sc.log1p(x))
Example #20
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logpdf(self, x, c): return np.log(c) - (c+1)*sc.log1p(x)
Example #21
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logcdf(self, x, h, k): condlist = [np.logical_and(h != 0, k != 0), np.logical_and(h == 0, k != 0), np.logical_and(h != 0, k == 0), np.logical_and(h == 0, k == 0)] def f0(x, h, k): '''cdf = (1.0 - h*(1.0 - k*x)**(1.0/k))**(1.0/h) logcdf = ... ''' return (1.0/h)*sc.log1p(-h*(1.0 - k*x)**(1.0/k)) def f1(x, h, k): '''cdf = np.exp(-(1.0 - k*x)**(1.0/k)) logcdf = ... ''' return -(1.0 - k*x)**(1.0/k) def f2(x, h, k): '''cdf = (1.0 - h*np.exp(-x))**(1.0/h) logcdf = ... ''' return (1.0/h)*sc.log1p(-h*np.exp(-x)) def f3(x, h, k): '''cdf = np.exp(-np.exp(-x)) logcdf = ... ''' return -np.exp(-x) return _lazyselect(condlist, [f0, f1, f2, f3], [x, h, k], default=np.nan)
Example #22
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logpdf(self, x): return -x - 2. * sc.log1p(np.exp(-x))
Example #23
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logpdf(self, x): return np.log(2) - x - 2. * sc.log1p(np.exp(-x))
Example #24
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q): return np.log(-sc.log1p(-q))
Example #25
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q, c): return sc.log1p(-1.0 / c * sc.log1p(-q))
Example #26
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _isf(self, q, c): x = -np.log(-sc.log1p(-q)) return _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: -sc.expm1(-c * x) / c, x)
Example #27
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logpdf(self, x, c): cx = _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: c*x, 0.0) logex2 = sc.log1p(-cx) logpex2 = self._loglogcdf(x, c) pex2 = np.exp(logpex2) # Handle special cases np.putmask(logpex2, (c == 0) & (x == -np.inf), 0.0) logpdf = np.where((cx == 1) | (cx == -np.inf), -np.inf, -pex2+logpex2-logex2) np.putmask(logpdf, (c == 1) & (x == 1), 0.0) return logpdf
Example #28
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _loglogcdf(self, x, c): return _lazywhere((x == x) & (c != 0), (x, c), lambda x, c: sc.log1p(-c*x)/c, -x)
Example #29
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _logpdf(self, x, c): return np.log(c) - x - (c+1.0)*sc.log1p(np.exp(-x))
Example #30
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _ppf(self, q, c): return pow(-sc.log1p(-q), 1.0/c)