mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-20 15:38:08 +02:00
Fix GPy.priors.InverseGamma (#903)
* fixed InverseGamma prior: beforehand, it was a child class of Gamma but it defined a broken __new__ method of its own. Now, it just inherits Gamma's __new__; also added a test that ensures the InverseGamma can be instantiated and integrated into a GPy model * overwrote misleading inherited methods in InverseGamma, deleted unnecessary repeated code
This commit is contained in:
parent
88d4fbf2c0
commit
62d735e6a6
2 changed files with 22 additions and 15 deletions
|
|
@ -55,6 +55,21 @@ class PriorTests(unittest.TestCase):
|
|||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
def test_InverseGamma(self):
|
||||
# Test that this prior object can be instantiated and performs its basic functions
|
||||
# in integration.
|
||||
xmin, xmax = 1, 2.5*np.pi
|
||||
b, C, SNR = 1, 0, 0.1
|
||||
X = np.linspace(xmin, xmax, 500)
|
||||
y = b*X + C + 1*np.sin(X)
|
||||
y += 0.05*np.random.randn(len(X))
|
||||
X, y = X[:, None], y[:, None]
|
||||
m = GPy.models.GPRegression(X, y)
|
||||
InverseGamma = GPy.priors.InverseGamma(1, 1)
|
||||
m.rbf.set_prior(InverseGamma)
|
||||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
def test_incompatibility(self):
|
||||
xmin, xmax = 1, 2.5*np.pi
|
||||
b, C, SNR = 1, 0, 0.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue