mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-11 15:15:15 +02:00
Merge with new changes from devel
This commit is contained in:
commit
673405d203
11 changed files with 107 additions and 11225 deletions
5
.appveyor_twine_upload.bat
Normal file
5
.appveyor_twine_upload.bat
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
IF "%APPVEYOR_REPO_BRANCH%"=="deploy" (
|
||||
twine upload --skip-existing dist/*
|
||||
) ELSE (
|
||||
ECHO Only deploy on deploy branch
|
||||
)
|
||||
11249
CHANGELOG.md
11249
CHANGELOG.md
File diff suppressed because it is too large
Load diff
|
|
@ -18,7 +18,7 @@ from .util import normalizer
|
|||
|
||||
# backwards compatibility
|
||||
import sys
|
||||
backwards_compatibility = ['lists_and_dicts', 'observable_array', 'ties_and_remappings', 'index_operations']
|
||||
backwards_compatibility = ['lists_and_dicts', 'observable_array', 'index_operations']
|
||||
for bc in backwards_compatibility:
|
||||
sys.modules['GPy.core.parameterization.{!s}'.format(bc)] = getattr(core.parameterization, bc)
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "1.8.0"
|
||||
__version__ = "1.8.4"
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ from .parameterized import Parameterized
|
|||
from . import transformations
|
||||
|
||||
from paramz.core import lists_and_dicts, index_operations, observable_array, observable
|
||||
from paramz import ties_and_remappings, ObsAr
|
||||
from paramz import ObsAr
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
import numpy as np
|
||||
from scipy.special import gammaln, digamma
|
||||
from ...util.linalg import pdinv
|
||||
from paramz.domains import _REAL, _POSITIVE
|
||||
from paramz.domains import _REAL, _POSITIVE, _NEGATIVE
|
||||
import warnings
|
||||
import weakref
|
||||
|
||||
|
|
@ -92,7 +92,6 @@ class Gaussian(Prior):
|
|||
# self.constant = -0.5 * np.log(2 * np.pi * self.sigma2)
|
||||
|
||||
class Uniform(Prior):
|
||||
domain = _REAL
|
||||
_instances = []
|
||||
|
||||
def __new__(cls, lower=0, upper=1): # Singleton:
|
||||
|
|
@ -101,13 +100,24 @@ class Uniform(Prior):
|
|||
for instance in cls._instances:
|
||||
if instance().lower == lower and instance().upper == upper:
|
||||
return instance()
|
||||
o = super(Prior, cls).__new__(cls, lower, upper)
|
||||
newfunc = super(Prior, cls).__new__
|
||||
if newfunc is object.__new__:
|
||||
o = newfunc(cls)
|
||||
else:
|
||||
o = newfunc(cls, lower, upper)
|
||||
cls._instances.append(weakref.ref(o))
|
||||
return cls._instances[-1]()
|
||||
|
||||
def __init__(self, lower, upper):
|
||||
self.lower = float(lower)
|
||||
self.upper = float(upper)
|
||||
assert self.lower < self.upper, "Lower needs to be strictly smaller than upper."
|
||||
if self.lower >= 0:
|
||||
self.domain = _POSITIVE
|
||||
elif self.upper <= 0:
|
||||
self.domain = _NEGATIVE
|
||||
else:
|
||||
self.domain = _REAL
|
||||
|
||||
def __str__(self):
|
||||
return "[{:.2g}, {:.2g}]".format(self.lower, self.upper)
|
||||
|
|
|
|||
|
|
@ -83,6 +83,35 @@ class PriorTests(unittest.TestCase):
|
|||
# should raise an assertionerror.
|
||||
self.assertRaises(AssertionError, m.rbf.set_prior, gaussian)
|
||||
|
||||
def test_uniform(self):
|
||||
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.SparseGPRegression(X, y)
|
||||
uniform = GPy.priors.Uniform(0, 2)
|
||||
m.rbf.set_prior(uniform)
|
||||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
m.Z.set_prior(uniform)
|
||||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
m.Z.unconstrain()
|
||||
uniform = GPy.priors.Uniform(-1, 10)
|
||||
m.Z.set_prior(uniform)
|
||||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
m.Z.constrain_negative()
|
||||
uniform = GPy.priors.Uniform(-1, 0)
|
||||
m.Z.set_prior(uniform)
|
||||
m.randomize()
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
def test_set_gaussian_for_reals(self):
|
||||
xmin, xmax = 1, 2.5*np.pi
|
||||
b, C, SNR = 1, 0, 0.1
|
||||
|
|
|
|||
15
appveyor.yml
15
appveyor.yml
|
|
@ -3,7 +3,7 @@ environment:
|
|||
secure: 8/ZjXFwtd1S7ixd7PJOpptupKKEDhm2da/q3unabJ00=
|
||||
COVERALLS_REPO_TOKEN:
|
||||
secure: d3Luic/ESkGaWnZrvWZTKrzO+xaVwJWaRCEP0F+K/9DQGPSRZsJ/Du5g3s4XF+tS
|
||||
gpy_version: 1.8.0
|
||||
gpy_version: 1.8.4
|
||||
matrix:
|
||||
- PYTHON_VERSION: 2.7
|
||||
MINICONDA: C:\Miniconda-x64
|
||||
|
|
@ -71,16 +71,7 @@ deploy_script:
|
|||
- echo repository = https://testpypi.python.org/pypi >> %USERPROFILE%\\.pypirc
|
||||
- echo username = maxz >> %USERPROFILE%\\.pypirc
|
||||
- echo password = %pip_access% >> %USERPROFILE%\\.pypirc
|
||||
- ps: >-
|
||||
If ($env:APPVEYOR_REPO_BRANCH -eq 'devel') {
|
||||
echo not deploying on devel # twine upload --skip-existing -r test dist/*
|
||||
}
|
||||
ElseIf ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {
|
||||
twine upload --skip-existing dist/*
|
||||
}
|
||||
Else {
|
||||
echo not deploying on other branches
|
||||
}
|
||||
- .appveyor_twine_upload.bat
|
||||
|
||||
# deploy:
|
||||
# - provider: GitHub
|
||||
|
|
@ -91,4 +82,4 @@ deploy_script:
|
|||
# prerelease: false
|
||||
# on:
|
||||
# branch: deploy # release from deploy branch only
|
||||
# appveyor_repo_tag: true # deploy on tag push only
|
||||
# appveyor_repo_tag: true # deploy on tag push only
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ For all Kerns the first parameter ``input_dim`` corresponds to the
|
|||
dimension of the input space, and the following parameters stand for
|
||||
the parameterization of the kernel.
|
||||
|
||||
You have to call ``super(<class_name>, self).__init__(input_dim,
|
||||
name)`` to make sure the input dimension and name of the kernel are
|
||||
You have to call ``super(<class_name>, self).__init__(input_dim, active_dims,
|
||||
name)`` to make sure the input dimension (and possible dimension restrictions using active_dims) and name of the kernel are
|
||||
stored in the right place. These attributes are available as
|
||||
``self.input_dim`` and ``self.name`` at runtime. Parameterization is
|
||||
done by adding :py:class:`~GPy.core.parameterization.param.Param`
|
||||
|
|
@ -53,8 +53,8 @@ your code. The parameters have to be added by calling
|
|||
:py:class:`~GPy.core.parameterization.param.Param` objects as
|
||||
arguments::
|
||||
|
||||
def __init__(self,input_dim,variance=1.,lengthscale=1.,power=1.):
|
||||
super(RationalQuadratic, self).__init__(input_dim, 'rat_quad')
|
||||
def __init__(self,input_dim,variance=1.,lengthscale=1.,power=1.,active_dims=None):
|
||||
super(RationalQuadratic, self).__init__(input_dim, active_dims, 'rat_quad')
|
||||
assert input_dim == 1, "For this kernel we assume input_dim=1"
|
||||
self.variance = Param('variance', variance)
|
||||
self.lengthscale = Param('lengtscale', lengthscale)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[bumpversion]
|
||||
current_version = 1.8.0
|
||||
current_version = 1.8.4
|
||||
tag = True
|
||||
commit = True
|
||||
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -150,7 +150,7 @@ setup(name = 'GPy',
|
|||
py_modules = ['GPy.__init__'],
|
||||
test_suite = 'GPy.testing',
|
||||
setup_requires = ['numpy>=1.7'],
|
||||
install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.7.4'],
|
||||
install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.8.5'],
|
||||
extras_require = {'docs':['sphinx'],
|
||||
'optional':['mpi4py',
|
||||
'ipython>=4.0.0',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue