merging with the main devel branch

This commit is contained in:
Akash Kumar Dhaka 2017-07-27 21:18:44 +03:00
commit ea6ea793fc
13 changed files with 265 additions and 44 deletions

View file

@ -16,8 +16,9 @@ addons:
env: env:
- PYTHON_VERSION=2.7 - PYTHON_VERSION=2.7
#- PYTHON_VERSION=3.3 #- PYTHON_VERSION=3.3
- PYTHON_VERSION=3.4 #- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5 - PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
before_install: before_install:
- wget https://github.com/mzwiessele/travis_scripts/raw/master/download_miniconda.sh - wget https://github.com/mzwiessele/travis_scripts/raw/master/download_miniconda.sh

View file

@ -1,5 +1,149 @@
# Changelog # Changelog
## v1.7.6 (2017-06-19)
### Fix
* Appveyor not uploading to testpypi for now. [mzwiessele]
### Other
* Bump version: 1.7.5 → 1.7.6. [mzwiessele]
## v1.7.5 (2017-06-19)
### Fix
* Splitting forecast tests into 3 to circumvent 10 minute stop of travis. [mzwiessele]
### Other
* Bump version: 1.7.4 → 1.7.5. [mzwiessele]
## v1.7.4 (2017-06-19)
### Fix
* Paramz version for parallel optimization fix. [mzwiessele]
### Other
* Bump version: 1.7.3 → 1.7.4. [mzwiessele]
## v1.7.3 (2017-06-19)
### Fix
* Appveyor build failing. [mzwiessele]
### Other
* Bump version: 1.7.2 → 1.7.3. [mzwiessele]
## v1.7.2 (2017-06-17)
### Fix
* Appveyor build python 3.6. [mzwiessele]
### Other
* Bump version: 1.7.1 → 1.7.2. [mzwiessele]
## v1.7.1 (2017-06-17)
### Fix
* Appveyor build python 3.6. [mzwiessele]
### Other
* Bump version: 1.7.0 → 1.7.1. [mzwiessele]
## v1.7.0 (2017-06-17)
### Fix
* Support for 3.5 and higher now that 3.6 is out. [mzwiessele]
### Other
* Bump version: 1.6.3 → 1.7.0. [mzwiessele]
## v1.6.3 (2017-06-17)
### Other
* Bump version: 1.6.2 → 1.6.3. [mzwiessele]
* Merge pull request #504 from rmcantin/devel. [Max Zwiessele]
* Fix python 2-3 compatibility. [Ruben Martinez-Cantin]
* Merge pull request #511 from dirmeier/devel. [Max Zwiessele]
* Added LICENSE file to MANIFEST.in. [dirmeier]
## v1.6.2 (2017-04-12)
### Fix
* Updated keywords. [mzwiessele]
### Other
* Bump version: 1.6.1 → 1.6.2. [mzwiessele]
* Merge pull request #491 from alexfeld/parallel_opt. [Max Zwiessele]
fix for parallel optimization
* Fix in sparse_gp_mpi optimizer. [Alex Feldstein]
* Fix for parallel optimization. [Alex Feldstein]
* Merge pull request #492 from pgmoren/devel. [Zhenwen Dai]
We did some benchmarking on classification. These changes should be fine. Let's merge it in.
* Changes in EP/EPDTC to fix numerical issues and increase the flexibility of the inference. [Moreno]
Changes to avoid numerical issues and improve the performance:
- Keep value of the EP parameters between calls
- Enforce positivity of tau_tilde
- Stable computation of the EP moments for the Bernoulli likelihood
- Compute marginal in the GP model without directly inverting tau_tilde
Changes to improve the flexibility:
- Add parameter for maximum number of iterations
- Distinguish between alternated/nested mode
- Distinguish between sequential/parallel updates in EP
* Merge pull request #489 from SheffieldML/linalg_cython-1. [Max Zwiessele]
cython in linalg fix #458
* Cython in linalg. [Max Zwiessele]
did set cython to working if linalg_cython was importable.
* Merge pull request #486 from SheffieldML/deploy. [Max Zwiessele]
Merge pull request #471 from SheffieldML/devel
* Merge pull request #471 from SheffieldML/devel. [Max Zwiessele]
new version
## v1.6.1 (2017-02-28) ## v1.6.1 (2017-02-28)
### Fix ### Fix

View file

@ -1 +1 @@
__version__ = "1.6.1" __version__ = "1.7.7"

View file

@ -562,11 +562,12 @@ class GP(Model):
""" """
self.inference_method.on_optimization_start() self.inference_method.on_optimization_start()
try: try:
super(GP, self).optimize(optimizer, start, messages, max_iters, ipython_notebook, clear_after_finish, **kwargs) ret = super(GP, self).optimize(optimizer, start, messages, max_iters, ipython_notebook, clear_after_finish, **kwargs)
except KeyboardInterrupt: except KeyboardInterrupt:
print("KeyboardInterrupt caught, calling on_optimization_end() to round things up") print("KeyboardInterrupt caught, calling on_optimization_end() to round things up")
self.inference_method.on_optimization_end() self.inference_method.on_optimization_end()
raise raise
return ret
def infer_newX(self, Y_new, optimize=True): def infer_newX(self, Y_new, optimize=True):
""" """

View file

@ -88,9 +88,9 @@ class SparseGP_MPI(SparseGP):
def optimize(self, optimizer=None, start=None, **kwargs): def optimize(self, optimizer=None, start=None, **kwargs):
self._IN_OPTIMIZATION_ = True self._IN_OPTIMIZATION_ = True
if self.mpi_comm==None: if self.mpi_comm==None:
super(SparseGP_MPI, self).optimize(optimizer,start,**kwargs) ret = super(SparseGP_MPI, self).optimize(optimizer,start,**kwargs)
elif self.mpi_comm.rank==0: elif self.mpi_comm.rank==0:
super(SparseGP_MPI, self).optimize(optimizer,start,**kwargs) ret = super(SparseGP_MPI, self).optimize(optimizer,start,**kwargs)
self.mpi_comm.Bcast(np.int32(-1),root=0) self.mpi_comm.Bcast(np.int32(-1),root=0)
elif self.mpi_comm.rank>0: elif self.mpi_comm.rank>0:
x = self.optimizer_array.copy() x = self.optimizer_array.copy()
@ -111,6 +111,7 @@ class SparseGP_MPI(SparseGP):
self._IN_OPTIMIZATION_ = False self._IN_OPTIMIZATION_ = False
raise Exception("Unrecognizable flag for synchronization!") raise Exception("Unrecognizable flag for synchronization!")
self._IN_OPTIMIZATION_ = False self._IN_OPTIMIZATION_ = False
return ret
def parameters_changed(self): def parameters_changed(self):
if isinstance(self.inference_method,VarDTC_minibatch): if isinstance(self.inference_method,VarDTC_minibatch):

View file

@ -306,11 +306,7 @@ class StateSpaceKernelsTests(np.testing.TestCase):
gp_kernel=gp_kernel, gp_kernel=gp_kernel,
mean_compare_decimal=2, var_compare_decimal=2) mean_compare_decimal=2, var_compare_decimal=2)
def test_forecast(self,): def test_forecast_regular(self,):
"""
Test time-series forecasting.
"""
# Generate data -> # Generate data ->
np.random.seed(339) # seed the random number generator np.random.seed(339) # seed the random number generator
#import pdb; pdb.set_trace() #import pdb; pdb.set_trace()
@ -334,37 +330,102 @@ class StateSpaceKernelsTests(np.testing.TestCase):
#import pdb; pdb.set_trace() #import pdb; pdb.set_trace()
def get_new_kernels(): periodic_kernel = GPy.kern.StdPeriodic(1,active_dims=[0,])
periodic_kernel = GPy.kern.StdPeriodic(1,active_dims=[0,]) gp_kernel = GPy.kern.Linear(1, active_dims=[0,]) + GPy.kern.Bias(1, active_dims=[0,]) + periodic_kernel
gp_kernel = GPy.kern.Linear(1, active_dims=[0,]) + GPy.kern.Bias(1, active_dims=[0,]) + periodic_kernel gp_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
gp_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000) gp_kernel.std_periodic.period.constrain_bounded(0.15, 100)
gp_kernel.std_periodic.period.constrain_bounded(0.15, 100)
periodic_kernel = GPy.kern.sde_StdPeriodic(1,active_dims=[0,]) periodic_kernel = GPy.kern.sde_StdPeriodic(1,active_dims=[0,])
ss_kernel = GPy.kern.sde_Linear(1,X,active_dims=[0,]) + \ ss_kernel = GPy.kern.sde_Linear(1,X,active_dims=[0,]) + \
GPy.kern.sde_Bias(1, active_dims=[0,]) + periodic_kernel GPy.kern.sde_Bias(1, active_dims=[0,]) + periodic_kernel
ss_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000) ss_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
ss_kernel.std_periodic.period.constrain_bounded(0.15, 100) ss_kernel.std_periodic.period.constrain_bounded(0.15, 100)
return ss_kernel, gp_kernel
ss_kernel, gp_kernel = get_new_kernels()
self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'regular', self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'regular',
use_cython=False, optimize_max_iters=30, check_gradients=True, use_cython=False, optimize_max_iters=30, check_gradients=True,
predict_X=X_test, predict_X=X_test,
gp_kernel=gp_kernel, gp_kernel=gp_kernel,
mean_compare_decimal=2, var_compare_decimal=2) mean_compare_decimal=2, var_compare_decimal=2)
def test_forecast_svd(self,):
# Generate data ->
np.random.seed(339) # seed the random number generator
#import pdb; pdb.set_trace()
(X,Y) = generate_sine_data(x_points=None, sin_period=5.0, sin_ampl=5.0, noise_var=2.0,
plot = False, points_num=100, x_interval = (0, 40), random=True)
(X1,Y1) = generate_linear_data(x_points=X, tangent=1.0, add_term=20.0, noise_var=0.0,
plot = False, points_num=100, x_interval = (0, 40), random=True)
Y = Y + Y1
X_train = X[X <= 20]
Y_train = Y[X <= 20]
X_test = X[X > 20]
Y_test = Y[X > 20]
X.shape = (X.shape[0],1); Y.shape = (Y.shape[0],1)
X_train.shape = (X_train.shape[0],1); Y_train.shape = (Y_train.shape[0],1)
X_test.shape = (X_test.shape[0],1); Y_test.shape = (Y_test.shape[0],1)
# Generate data <-
#import pdb; pdb.set_trace()
periodic_kernel = GPy.kern.StdPeriodic(1,active_dims=[0,])
gp_kernel = GPy.kern.Linear(1, active_dims=[0,]) + GPy.kern.Bias(1, active_dims=[0,]) + periodic_kernel
gp_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
gp_kernel.std_periodic.period.constrain_bounded(0.15, 100)
periodic_kernel = GPy.kern.sde_StdPeriodic(1,active_dims=[0,])
ss_kernel = GPy.kern.sde_Linear(1,X,active_dims=[0,]) + \
GPy.kern.sde_Bias(1, active_dims=[0,]) + periodic_kernel
ss_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
ss_kernel.std_periodic.period.constrain_bounded(0.15, 100)
ss_kernel, gp_kernel = get_new_kernels()
self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'svd', self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'svd',
use_cython=False, optimize_max_iters=30, check_gradients=False, use_cython=False, optimize_max_iters=30, check_gradients=False,
predict_X=X_test, predict_X=X_test,
gp_kernel=gp_kernel, gp_kernel=gp_kernel,
mean_compare_decimal=2, var_compare_decimal=2) mean_compare_decimal=2, var_compare_decimal=2)
ss_kernel, gp_kernel = get_new_kernels() def test_forecast_svd_cython(self,):
# Generate data ->
np.random.seed(339) # seed the random number generator
#import pdb; pdb.set_trace()
(X,Y) = generate_sine_data(x_points=None, sin_period=5.0, sin_ampl=5.0, noise_var=2.0,
plot = False, points_num=100, x_interval = (0, 40), random=True)
(X1,Y1) = generate_linear_data(x_points=X, tangent=1.0, add_term=20.0, noise_var=0.0,
plot = False, points_num=100, x_interval = (0, 40), random=True)
Y = Y + Y1
X_train = X[X <= 20]
Y_train = Y[X <= 20]
X_test = X[X > 20]
Y_test = Y[X > 20]
X.shape = (X.shape[0],1); Y.shape = (Y.shape[0],1)
X_train.shape = (X_train.shape[0],1); Y_train.shape = (Y_train.shape[0],1)
X_test.shape = (X_test.shape[0],1); Y_test.shape = (Y_test.shape[0],1)
# Generate data <-
#import pdb; pdb.set_trace()
periodic_kernel = GPy.kern.StdPeriodic(1,active_dims=[0,])
gp_kernel = GPy.kern.Linear(1, active_dims=[0,]) + GPy.kern.Bias(1, active_dims=[0,]) + periodic_kernel
gp_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
gp_kernel.std_periodic.period.constrain_bounded(0.15, 100)
periodic_kernel = GPy.kern.sde_StdPeriodic(1,active_dims=[0,])
ss_kernel = GPy.kern.sde_Linear(1,X,active_dims=[0,]) + \
GPy.kern.sde_Bias(1, active_dims=[0,]) + periodic_kernel
ss_kernel.std_periodic.lengthscale.constrain_bounded(0.25, 1000)
ss_kernel.std_periodic.period.constrain_bounded(0.15, 100)
self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'svd', self.run_for_model(X_train, Y_train, ss_kernel, kalman_filter_type = 'svd',
use_cython=True, optimize_max_iters=30, check_gradients=False, use_cython=True, optimize_max_iters=30, check_gradients=False,
predict_X=X_test, predict_X=X_test,

View file

@ -206,7 +206,10 @@ def authorize_download(dataset_name=None):
def download_data(dataset_name=None): def download_data(dataset_name=None):
"""Check with the user that the are happy with terms and conditions for the data set, then download it.""" """Check with the user that the are happy with terms and conditions for the data set, then download it."""
import itertools try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
dr = data_resources[dataset_name] dr = data_resources[dataset_name]
if not authorize_download(dataset_name): if not authorize_download(dataset_name):
@ -220,8 +223,8 @@ def download_data(dataset_name=None):
if 'suffices' in dr: zip_urls += (dr['suffices'], ) if 'suffices' in dr: zip_urls += (dr['suffices'], )
else: zip_urls += ([],) else: zip_urls += ([],)
for url, files, save_names, suffices in itertools.zip_longest(*zip_urls, fillvalue=[]): for url, files, save_names, suffices in zip_longest(*zip_urls, fillvalue=[]):
for f, save_name, suffix in itertools.zip_longest(files, save_names, suffices, fillvalue=None): for f, save_name, suffix in zip_longest(files, save_names, suffices, fillvalue=None):
download_url(os.path.join(url,f), dataset_name, save_name, suffix=suffix) download_url(os.path.join(url,f), dataset_name, save_name, suffix=suffix)
return True return True

View file

@ -1,7 +1,7 @@
''' '''
Created on Aug 27, 2014 Created on Aug 27, 2014
@author: t-mazwie @author: Max Zwiessele
''' '''
import logging import logging
import numpy as np import numpy as np

View file

@ -16,6 +16,9 @@ recursive-include GPy *.c
recursive-include GPy *.h recursive-include GPy *.h
recursive-include GPy *.pyx recursive-include GPy *.pyx
# LICENSE
include LICENSE.txt
# Testing # Testing
#include GPy/testing/baseline/*.png #include GPy/testing/baseline/*.png
#include GPy/testing/pickle_test.pickle #include GPy/testing/pickle_test.pickle

View file

@ -76,7 +76,7 @@ If that is the case, it is best to clean the repo and reinstall.
[<img src="https://upload.wikimedia.org/wikipedia/commons/8/8e/OS_X-Logo.svg" height=40px>](http://www.apple.com/osx/) [<img src="https://upload.wikimedia.org/wikipedia/commons/8/8e/OS_X-Logo.svg" height=40px>](http://www.apple.com/osx/)
[<img src="https://upload.wikimedia.org/wikipedia/commons/3/35/Tux.svg" height=40px>](https://en.wikipedia.org/wiki/List_of_Linux_distributions) [<img src="https://upload.wikimedia.org/wikipedia/commons/3/35/Tux.svg" height=40px>](https://en.wikipedia.org/wiki/List_of_Linux_distributions)
Python 2.7, 3.4 and higher Python 2.7, 3.5 and higher
## Citation ## Citation

View file

@ -3,12 +3,14 @@ environment:
secure: 8/ZjXFwtd1S7ixd7PJOpptupKKEDhm2da/q3unabJ00= secure: 8/ZjXFwtd1S7ixd7PJOpptupKKEDhm2da/q3unabJ00=
COVERALLS_REPO_TOKEN: COVERALLS_REPO_TOKEN:
secure: d3Luic/ESkGaWnZrvWZTKrzO+xaVwJWaRCEP0F+K/9DQGPSRZsJ/Du5g3s4XF+tS secure: d3Luic/ESkGaWnZrvWZTKrzO+xaVwJWaRCEP0F+K/9DQGPSRZsJ/Du5g3s4XF+tS
gpy_version: 1.6.1 gpy_version: 1.7.7
matrix: matrix:
- PYTHON_VERSION: 2.7 - PYTHON_VERSION: 2.7
MINICONDA: C:\Miniconda-x64 MINICONDA: C:\Miniconda-x64
- PYTHON_VERSION: 3.5 - PYTHON_VERSION: 3.5
MINICONDA: C:\Miniconda35-x64 MINICONDA: C:\Miniconda35-x64
- PYTHON_VERSION: 3.6
MINICONDA: C:\Miniconda36-x64
#configuration: #configuration:
# - Debug # - Debug
@ -62,21 +64,21 @@ deploy_script:
- echo test >> %USERPROFILE%\\.pypirc - echo test >> %USERPROFILE%\\.pypirc
- echo[ - echo[
- echo [pypi] >> %USERPROFILE%\\.pypirc - echo [pypi] >> %USERPROFILE%\\.pypirc
- echo username:maxz >> %USERPROFILE%\\.pypirc - echo username = maxz >> %USERPROFILE%\\.pypirc
- echo password:%pip_access% >> %USERPROFILE%\\.pypirc - echo password = %pip_access% >> %USERPROFILE%\\.pypirc
- echo[ - echo[
- echo [test] >> %USERPROFILE%\\.pypirc - echo [test] >> %USERPROFILE%\\.pypirc
- echo repository:https://test.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc - echo repository = https://testpypi.python.org/pypi >> %USERPROFILE%\\.pypirc
- echo username:maxz >> %USERPROFILE%\\.pypirc - echo username = maxz >> %USERPROFILE%\\.pypirc
- echo password:%pip_access% >> %USERPROFILE%\\.pypirc - echo password = %pip_access% >> %USERPROFILE%\\.pypirc
- ps: >- - ps: >-
if ($env:APPVEYOR_REPO_BRANCH -eq 'devel') { If ($env:APPVEYOR_REPO_BRANCH -eq 'devel') {
twine upload --skip-existing -r test dist/* echo not deploying on devel # twine upload --skip-existing -r test dist/*
} }
elseif ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') { ElseIf ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {
twine upload --skip-existing dist/* twine upload --skip-existing dist/*
} }
else { Else {
echo not deploying on other branches echo not deploying on other branches
} }

View file

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 1.6.1 current_version = 1.7.7
tag = True tag = True
commit = True commit = True

View file

@ -150,7 +150,7 @@ setup(name = 'GPy',
py_modules = ['GPy.__init__'], py_modules = ['GPy.__init__'],
test_suite = 'GPy.testing', test_suite = 'GPy.testing',
setup_requires = ['numpy>=1.7'], setup_requires = ['numpy>=1.7'],
install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.6.9'], install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.7.4'],
extras_require = {'docs':['sphinx'], extras_require = {'docs':['sphinx'],
'optional':['mpi4py', 'optional':['mpi4py',
'ipython>=4.0.0', 'ipython>=4.0.0',
@ -169,9 +169,14 @@ setup(name = 'GPy',
'Operating System :: Microsoft :: Windows', 'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux', 'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Framework :: IPython',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Python Modules',
] ]
) )