Updated other likelihoods to give back logpdf and gradients for each link_f rather than summing on the inside

This commit is contained in:
Alan Saul 2015-03-09 10:27:21 +00:00
parent 48821a6b73
commit 233c5ee8b4
7 changed files with 22 additions and 42 deletions

View file

@ -362,7 +362,7 @@ class TestNoiseModels(object):
def t_dlogpdf_df(self, model, Y, f):
print "\n{}".format(inspect.stack()[0][3])
self.description = "\n{}".format(inspect.stack()[0][3])
logpdf = functools.partial(model.logpdf, y=Y)
logpdf = functools.partial(np.sum(model.logpdf), y=Y)
dlogpdf_df = functools.partial(model.dlogpdf_df, y=Y)
grad = GradientChecker(logpdf, dlogpdf_df, f.copy(), 'g')
grad.randomize()
@ -652,9 +652,9 @@ class LaplaceTests(unittest.TestCase):
print m2
optimizer = 'scg'
print "Gaussian"
m1.optimize(optimizer, messages=debug)
m1.optimize(optimizer, messages=debug, ipython_notebook=False)
print "Laplace Gaussian"
m2.optimize(optimizer, messages=debug)
m2.optimize(optimizer, messages=debug, ipython_notebook=False)
if debug:
print m1
print m2