[merge] setup.py

This commit is contained in:
Max Zwiessele 2015-09-10 08:46:41 +01:00
commit 6acf5dcfac
2 changed files with 6 additions and 5 deletions

View file

@ -32,7 +32,7 @@ class RVTransformationTestCase(unittest.TestCase):
m.theta.unconstrain() m.theta.unconstrain()
m.theta.constrain(trans) m.theta.constrain(trans)
# The PDF of the transformed variables # The PDF of the transformed variables
p_phi = lambda(phi): np.exp(-m._objective_grads(phi)[0]) p_phi = lambda phi : np.exp(-m._objective_grads(phi)[0])
# To the empirical PDF of: # To the empirical PDF of:
theta_s = prior.rvs(100000) theta_s = prior.rvs(100000)
phi_s = trans.finv(theta_s) phi_s = trans.finv(theta_s)
@ -56,7 +56,7 @@ class RVTransformationTestCase(unittest.TestCase):
# The following test cannot be very accurate # The following test cannot be very accurate
self.assertTrue(np.linalg.norm(pdf_phi - kde(phi)) / np.linalg.norm(kde(phi)) <= 1e-1) self.assertTrue(np.linalg.norm(pdf_phi - kde(phi)) / np.linalg.norm(kde(phi)) <= 1e-1)
# Check the gradients at a few random points # Check the gradients at a few random points
for i in xrange(10): for i in range(10):
m.theta = theta_s[i] m.theta = theta_s[i]
self.assertTrue(m.checkgrad(verbose=True)) self.assertTrue(m.checkgrad(verbose=True))
@ -73,7 +73,7 @@ if __name__ == '__main__':
m.theta.set_prior(prior) m.theta.set_prior(prior)
# The following should return the PDF in terms of the transformed quantities # The following should return the PDF in terms of the transformed quantities
p_phi = lambda(phi): np.exp(-m._objective_grads(phi)[0]) p_phi = lambda phi : np.exp(-m._objective_grads(phi)[0])
# Let's look at the transformation phi = log(exp(theta - 1)) # Let's look at the transformation phi = log(exp(theta - 1))
trans = GPy.constraints.Exponent() trans = GPy.constraints.Exponent()

View file

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import print_function
import os import os
import sys import sys
from setuptools import setup, Extension from setuptools import setup, Extension
import numpy as np import numpy as np
def read(fname): def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() return open(os.path.join(os.path.dirname(__file__), fname)).read()
@ -22,7 +23,7 @@ exec(read('GPy/__version__.py'), version_dummy)
__version__ = version_dummy['__version__'] __version__ = version_dummy['__version__']
del version_dummy del version_dummy
#Mac OS X Clang doesn't support OpenMP th the current time. #Mac OS X Clang doesn't support OpenMP at the current time.
#This detects if we are building on a Mac #This detects if we are building on a Mac
def ismac(): def ismac():
platform = sys.platform platform = sys.platform