Skip to content

Commit

Permalink
fix: Gamma prior no assignment after init
Browse files Browse the repository at this point in the history
  • Loading branch information
mzwiessele committed Feb 22, 2018
1 parent 34a5e7e commit 47cf3ed
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions GPy/core/parameterization/priors.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,17 @@ def __new__(cls, a=1, b=.5): # Singleton:
cls._instances.append(weakref.ref(o))
return cls._instances[-1]()

@property
def a(self):
return self._a

@property
def b(self):
return self._b

def __init__(self, a, b):
self.a = float(a)
self.b = float(b)
self._a = float(a)
self._b = float(b)
self.constant = -gammaln(self.a) + a * np.log(b)

def __str__(self):
Expand Down Expand Up @@ -333,8 +341,8 @@ def __getstate__(self):
return self.a, self.b

def __setstate__(self, state):
self.a = state[0]
self.b = state[1]
self._a = state[0]
self._b = state[1]
self.constant = -gammaln(self.a) + self.a * np.log(self.b)

class InverseGamma(Gamma):
Expand All @@ -360,8 +368,8 @@ def __new__(cls, a=1, b=.5): # Singleton:
return cls._instances[-1]()

def __init__(self, a, b):
self.a = float(a)
self.b = float(b)
self._a = float(a)
self._b = float(b)
self.constant = -gammaln(self.a) + a * np.log(b)

def __str__(self):
Expand Down

0 comments on commit 47cf3ed

Please sign in to comment.