MCPcopy
hub / github.com/hyperopt/hyperopt / loguniform_gen

Class loguniform_gen

hyperopt/rdists.py:13–32  ·  view source on GitHub ↗

Stats for Y = e^X where X ~ U(low, high).

Source from the content-addressed store, hash-verified

11
12
13class loguniform_gen(rv_continuous):
14 """Stats for Y = e^X where X ~ U(low, high)."""
15
16 def __init__(self, low=0, high=1):
17 rv_continuous.__init__(self, a=np.exp(low), b=np.exp(high))
18 self._low = low
19 self._high = high
20
21 def _rvs(self):
22 rval = np.exp(mtrand.uniform(self._low, self._high, self._size))
23 return rval
24
25 def _pdf(self, x):
26 return old_div(1.0, (x * (self._high - self._low)))
27
28 def _logpdf(self, x):
29 return -np.log(x) - np.log(self._high - self._low)
30
31 def _cdf(self, x):
32 return old_div((np.log(x) - self._low), (self._high - self._low))
33
34
35class lognorm_gen(scipy_lognorm_gen):

Callers 6

test_cdf_logcdfMethod · 0.90
test_cdf_ppfMethod · 0.90
test_pdf_logpdfMethod · 0.90
test_pdfMethod · 0.90
test_distribution_rvsMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by 5

test_cdf_logcdfMethod · 0.72
test_cdf_ppfMethod · 0.72
test_pdf_logpdfMethod · 0.72
test_pdfMethod · 0.72
test_distribution_rvsMethod · 0.72