Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pdfs.GammaPdf: fix support, 0.0 is not included

  • Loading branch information...
commit fc953621f951b13ae18b130e864188e246222a6c 1 parent 9360a1c
@strohel authored
Showing with 2 additions and 7 deletions.
  1. +1 −6 pybayes/pdfs.py
  2. +1 −1  pybayes/tests/test_pdfs.py
View
7 pybayes/pdfs.py
@@ -669,13 +669,8 @@ def variance(self, cond = None):
def eval_log(self, x, cond = None):
self._check_x(x)
- if x[0] < 0.:
+ if x[0] <= 0.:
return float('-inf')
- if x == 0.:
- if self.k == 1:
- return -math.lgamma(self.k) - self.k*math.log(self.theta)
- else:
- return -math.lgamma(self.k) - self.k*math.log(self.theta) + (self.k - 1)*float('-inf')
return -math.lgamma(self.k) - self.k*math.log(self.theta) + (self.k - 1)*math.log(x[0]) - x[0]/self.theta
def sample(self, cond = None):
View
2  pybayes/tests/test_pdfs.py
@@ -504,7 +504,7 @@ def test_variance(self):
def test_eval_log(self):
exp_results = np.array([
[0. , 0. ], # eval in -1
- [0.3125 , 0. ], # in 0
+ [0. , 0. ], # in 0
[0.2286298840458256, 0.0231977161187639], # in 1
[0.1672691964121845, 0.0921648960588247], # in 2
[0.1223767583364997, 0.1500982961404964], # ...
Please sign in to comment.
Something went wrong with that request. Please try again.