Merge branch 'devel' into plotting_tests

This commit is contained in:
mzwiessele 2016-08-03 08:52:10 +01:00
commit 218840d05c
14 changed files with 156 additions and 46 deletions

View file

@ -15,7 +15,7 @@ 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
@ -61,7 +61,6 @@ deploy:
password: password:
secure: "vMEOlP7DQhFJ7hQAKtKC5hrJXFl5BkUt4nXdosWWiw//Kg8E+PPLg88XPI2gqIosir9wwgtbSBBbbwCxkM6uxRNMpoNR8Ixyv9fmSXp4rLl7bbBY768W7IRXKIBjpuEy2brQjoT+CwDDSzUkckHvuUjJDNRvUv8ab4P/qYO1LG4=" secure: "vMEOlP7DQhFJ7hQAKtKC5hrJXFl5BkUt4nXdosWWiw//Kg8E+PPLg88XPI2gqIosir9wwgtbSBBbbwCxkM6uxRNMpoNR8Ixyv9fmSXp4rLl7bbBY768W7IRXKIBjpuEy2brQjoT+CwDDSzUkckHvuUjJDNRvUv8ab4P/qYO1LG4="
on: on:
tags: true
branch: deploy branch: deploy
distributions: $DIST distributions: $DIST
skip_cleanup: true skip_cleanup: true

View file

@ -1 +1 @@
__version__ = "1.0.9" __version__ = "1.2.0"

View file

@ -7,4 +7,6 @@ from .mlp import MLP
from .additive import Additive from .additive import Additive
from .compound import Compound from .compound import Compound
from .constant import Constant from .constant import Constant
from .identity import Identity
from .piecewise_linear import PiecewiseLinear

View file

@ -17,7 +17,7 @@ class GPCoregionalizedRegression(GP):
:type X_list: list of numpy arrays :type X_list: list of numpy arrays
:param Y_list: list of observed values related to the different noise models :param Y_list: list of observed values related to the different noise models
:type Y_list: list of numpy arrays :type Y_list: list of numpy arrays
:param kernel: a GPy kernel, defaults to RBF ** Coregionalized :param kernel: a GPy kernel ** Coregionalized, defaults to RBF ** Coregionalized
:type kernel: None | GPy.kernel defaults :type kernel: None | GPy.kernel defaults
:likelihoods_list: a list of likelihoods, defaults to list of Gaussian likelihoods :likelihoods_list: a list of likelihoods, defaults to list of Gaussian likelihoods
:type likelihoods_list: None | a list GPy.likelihoods :type likelihoods_list: None | a list GPy.likelihoods

View file

@ -19,7 +19,7 @@ class SparseGPCoregionalizedRegression(SparseGP):
:type Y_list: list of numpy arrays :type Y_list: list of numpy arrays
:param Z_list: list of inducing inputs (optional) :param Z_list: list of inducing inputs (optional)
:type Z_list: empty list | list of numpy arrays :type Z_list: empty list | list of numpy arrays
:param kernel: a GPy kernel, defaults to RBF ** Coregionalized :param kernel: a GPy kernel ** Coregionalized, defaults to RBF ** Coregionalized
:type kernel: None | GPy.kernel defaults :type kernel: None | GPy.kernel defaults
:likelihoods_list: a list of likelihoods, defaults to list of Gaussian likelihoods :likelihoods_list: a list of likelihoods, defaults to list of Gaussian likelihoods
:type likelihoods_list: None | a list GPy.likelihoods :type likelihoods_list: None | a list GPy.likelihoods

View file

@ -34,7 +34,7 @@ def plot(parameterized, fignum=None, ax=None, colors=None, figsize=(12, 6)):
else: else:
raise ValueError("Need one ax per latent dimension input_dim") raise ValueError("Need one ax per latent dimension input_dim")
bg_lines.append(a.plot(means, c='k', alpha=.3)) bg_lines.append(a.plot(means, c='k', alpha=.3))
lines.extend(a.plot(x, means.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i))) lines.extend(a.plot(x, means.T[i], c=next(colors), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
fills.append(a.fill_between(x, fills.append(a.fill_between(x,
means.T[i] - 2 * np.sqrt(variances.T[i]), means.T[i] - 2 * np.sqrt(variances.T[i]),
means.T[i] + 2 * np.sqrt(variances.T[i]), means.T[i] + 2 * np.sqrt(variances.T[i]),
@ -86,7 +86,7 @@ def plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_sid
# mean and variance plot # mean and variance plot
a = fig.add_subplot(*sub1) a = fig.add_subplot(*sub1)
a.plot(means, c='k', alpha=.3) a.plot(means, c='k', alpha=.3)
plots.extend(a.plot(x, means.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i))) plots.extend(a.plot(x, means.T[i], c=next(colors), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
a.fill_between(x, a.fill_between(x,
means.T[i] - 2 * np.sqrt(variances.T[i]), means.T[i] - 2 * np.sqrt(variances.T[i]),
means.T[i] + 2 * np.sqrt(variances.T[i]), means.T[i] + 2 * np.sqrt(variances.T[i]),

View file

@ -127,28 +127,32 @@ class SparseGPMinibatchTest(unittest.TestCase):
def test_sparsegp_init(self): def test_sparsegp_init(self):
# Test if the different implementations give the exact same likelihood as the full model. # Test if the different implementations give the exact same likelihood as the full model.
# All of the following settings should give the same likelihood and gradients as the full model: # All of the following settings should give the same likelihood and gradients as the full model:
np.random.seed(1234) try:
Z = self.X[np.random.choice(self.X.shape[0], replace=False, size=10)].copy() np.random.seed(1234)
Q = Z.shape[1] Z = self.X[np.random.choice(self.X.shape[0], replace=False, size=10)].copy()
m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=True, stochastic=False) Q = Z.shape[1]
assert(m.checkgrad()) m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=True, stochastic=False)
m.optimize('adadelta', max_iters=10) assert(m.checkgrad())
assert(m.checkgrad()) m.optimize('adadelta', max_iters=10)
assert(m.checkgrad())
m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=True, stochastic=True)
assert(m.checkgrad()) m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=True, stochastic=True)
m.optimize('rprop', max_iters=10) assert(m.checkgrad())
assert(m.checkgrad()) m.optimize('rprop', max_iters=10)
assert(m.checkgrad())
m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=False, stochastic=False)
assert(m.checkgrad()) m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=False, stochastic=False)
m.optimize('rprop', max_iters=10) assert(m.checkgrad())
assert(m.checkgrad()) m.optimize('rprop', max_iters=10)
assert(m.checkgrad())
m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=False, stochastic=True)
assert(m.checkgrad()) m = GPy.models.sparse_gp_minibatch.SparseGPMiniBatch(self.X, self.Y, Z, GPy.kern.RBF(Q)+GPy.kern.Matern32(Q)+GPy.kern.Bias(Q), GPy.likelihoods.Gaussian(), missing_data=False, stochastic=True)
m.optimize('adadelta', max_iters=10) assert(m.checkgrad())
assert(m.checkgrad()) m.optimize('adadelta', max_iters=10)
assert(m.checkgrad())
except ImportError:
from nose import SkipTest
raise SkipTest('climin not installed, skipping stochastic gradients')
def test_predict_missing_data(self): def test_predict_missing_data(self):
m = GPy.models.bayesian_gplvm_minibatch.BayesianGPLVMMiniBatch(self.Y, self.Q, X_variance=False, missing_data=True, stochastic=True, batchsize=self.Y.shape[1]) m = GPy.models.bayesian_gplvm_minibatch.BayesianGPLVMMiniBatch(self.Y, self.Q, X_variance=False, missing_data=True, stochastic=True, batchsize=self.Y.shape[1])

View file

@ -12,7 +12,7 @@ except ImportError:
import configparser import configparser
config = configparser.ConfigParser() config = configparser.ConfigParser()
from configparser import NoOptionError from configparser import NoOptionError
# This is the default configuration file that always needs to be present. # This is the default configuration file that always needs to be present.
default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'defaults.cfg')) default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'defaults.cfg'))
@ -23,7 +23,7 @@ local_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'in
# This specifies configurations specific to the user (it is found in the user home directory) # This specifies configurations specific to the user (it is found in the user home directory)
home = os.getenv('HOME') or os.getenv('USERPROFILE') home = os.getenv('HOME') or os.getenv('USERPROFILE')
user_file = os.path.join(home,'.config','gpy', 'user.cfg') user_file = os.path.join(home,'.config','GPy', 'user.cfg')
# Read in the given files. # Read in the given files.
config.readfp(open(default_file)) config.readfp(open(default_file))

View file

@ -131,7 +131,7 @@ class PCA(object):
kwargs.update(dict(s=s)) kwargs.update(dict(s=s))
plots = list() plots = list()
for i, l in enumerate(ulabels): for i, l in enumerate(ulabels):
kwargs.update(dict(color=colors.next(), marker=marker[i % len(marker)])) kwargs.update(dict(color=next(colors), marker=marker[i % len(marker)]))
plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs)) plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs))
ax.set_xlabel(r"PC$_1$") ax.set_xlabel(r"PC$_1$")
ax.set_ylabel(r"PC$_2$") ax.set_ylabel(r"PC$_2$")

View file

@ -9,7 +9,7 @@ The Gaussian processes framework in Python.
* Travis-CI [unit-tests](https://travis-ci.org/SheffieldML/GPy) * Travis-CI [unit-tests](https://travis-ci.org/SheffieldML/GPy)
* [![licence](https://img.shields.io/badge/licence-BSD-blue.svg)](http://opensource.org/licenses/BSD-3-Clause) * [![licence](https://img.shields.io/badge/licence-BSD-blue.svg)](http://opensource.org/licenses/BSD-3-Clause)
[![develstat](https://travis-ci.org/SheffieldML/GPy.svg?branch=devel)](https://travis-ci.org/SheffieldML/GPy) [![covdevel](http://codecov.io/github/SheffieldML/GPy/coverage.svg?branch=devel)](http://codecov.io/github/SheffieldML/GPy?branch=devel) [![Research software impact](http://depsy.org/api/package/pypi/GPy/badge.svg)](http://depsy.org/package/python/GPy) [![Code Health](https://landscape.io/github/SheffieldML/GPy/devel/landscape.svg?style=flat)](https://landscape.io/github/SheffieldML/GPy/devel) [![develstat](https://travis-ci.org/SheffieldML/GPy.svg?branch=devel)](https://travis-ci.org/SheffieldML/GPy) [![appveyor](https://ci.appveyor.com/api/projects/status/662o6tha09m2jix3/branch/deploy?svg=true)](https://ci.appveyor.com/project/mzwiessele/gpy/branch/deploy) [![covdevel](http://codecov.io/github/SheffieldML/GPy/coverage.svg?branch=devel)](http://codecov.io/github/SheffieldML/GPy?branch=devel) [![Research software impact](http://depsy.org/api/package/pypi/GPy/badge.svg)](http://depsy.org/package/python/GPy) [![Code Health](https://landscape.io/github/SheffieldML/GPy/devel/landscape.svg?style=flat)](https://landscape.io/github/SheffieldML/GPy/devel)
## Updated Structure ## Updated Structure

89
appveyor.yml Normal file
View file

@ -0,0 +1,89 @@
environment:
pip_access:
secure: 8/ZjXFwtd1S7ixd7PJOpptupKKEDhm2da/q3unabJ00=
gpy_version: 1.2.0
matrix:
- PYTHON_VERSION: 2.7
MINICONDA: C:\Miniconda-x64
- PYTHON_VERSION: 3.5
MINICONDA: C:\Miniconda35-x64
#configuration:
# - Debug
# - Release
install:
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- "conda create -q -n build-environment python=%PYTHON_VERSION% numpy scipy matplotlib"
- activate build-environment
# We need wheel installed to build wheels
- python -m pip install wheel
# GPy needs paramz
- python -m pip install paramz
- python -m pip install nose-show-skipped
- python -m pip install coverage
- python -m pip install codecov
- python -m pip install twine
- "python setup.py develop"
build: off
test_script:
# Put your test command here.
# If you don't need to build C extensions on 64-bit Python 3.3 or 3.4,
# you can remove "build.cmd" from the front of the command, as it's
# only needed to support those cases.
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python evrsion you want to use on PATH.
#- "build.cmd %PYTHON%\\python.exe setup.py test"
- "coverage run travis_tests.py"
after_test:
# This step builds your wheels.
- "python setup.py bdist_wheel bdist_wininst"
- codecov
artifacts:
# bdist_wheel puts your built wheel in the dist directory
- path: dist\*
deploy_script:
- echo [distutils] > %USERPROFILE%\\.pypirc
- echo index-servers = >> %USERPROFILE%\\.pypirc
- echo pypi >> %USERPROFILE%\\.pypirc
- echo test >> %USERPROFILE%\\.pypirc
- echo[
- echo [pypi] >> %USERPROFILE%\\.pypirc
- echo username:maxz >> %USERPROFILE%\\.pypirc
- echo password:%pip_access% >> %USERPROFILE%\\.pypirc
- echo[
- echo [test] >> %USERPROFILE%\\.pypirc
- 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') {
twine upload -r test dist/*
}
elseif ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {
twine upload dist/*
}
else {
echo not deploying on other branches
}
# deploy:
# - provider: GitHub
# release: GPy-v$(gpy_version)
# description: 'GPy windows install'
# artifact: dist/*.exe # upload wininst to GitHub
# draft: false
# prerelease: false
# on:
# branch: deploy # release from deploy branch only
# appveyor_repo_tag: true # deploy on tag push only

24
codecov.yml Normal file
View file

@ -0,0 +1,24 @@
codecov:
branch: devel
coverage:
precision: 2
round: down
range: "40...100"
status:
project:
default:
target: auto
if_no_uploads: error
patch:
default:
if_no_uploads: error
changes: true
comment:
layout: "header, diff, changes, suggestions"
behavior: default

View file

@ -1,12 +1,11 @@
[bumpversion] [bumpversion]
current_version = 1.0.9 current_version = 1.2.0
tag = False tag = False
commit = True commit = True
[bumpversion:file:GPy/__version__.py] [bumpversion:file:GPy/__version__.py]
[bdist_wheel] [bumpversion:file:appveyor.yml]
universal = 1
[upload_docs] [upload_docs]
upload-dir = doc/build/html upload-dir = doc/build/html

View file

@ -59,14 +59,7 @@ def read_to_rst(fname):
desc = """ desc = """
- `GPy homepage <http://sheffieldml.github.io/GPy/>`_ Please refer to the github homepage for detailed instructions on installation and usage.
- `Tutorial notebooks <http://nbviewer.ipython.org/github/SheffieldML/notebook/blob/master/GPy/index.ipynb>`_
- `User mailing-list <https://lists.shef.ac.uk/sympa/subscribe/gpy-users>`_
- `Developer documentation <http://gpy.readthedocs.org/en/devel/>`_
- `Travis-CI unit-tests <https://travis-ci.org/SheffieldML/GPy>`_
- `License <https://opensource.org/licenses/BSD-3-Clause>`_
For full description and installation instructions please refer to the github page.
""" """
@ -116,6 +109,7 @@ setup(name = 'GPy',
author = read_to_rst('AUTHORS.txt'), author = read_to_rst('AUTHORS.txt'),
author_email = "gpy.authors@gmail.com", author_email = "gpy.authors@gmail.com",
description = ("The Gaussian Process Toolbox"), description = ("The Gaussian Process Toolbox"),
long_description = desc,
license = "BSD 3-clause", license = "BSD 3-clause",
keywords = "machine-learning gaussian-processes kernels", keywords = "machine-learning gaussian-processes kernels",
url = "http://sheffieldml.github.com/GPy/", url = "http://sheffieldml.github.com/GPy/",
@ -154,8 +148,7 @@ setup(name = 'GPy',
include_package_data = True, include_package_data = True,
py_modules = ['GPy.__init__'], py_modules = ['GPy.__init__'],
test_suite = 'GPy.testing', test_suite = 'GPy.testing',
long_description=desc, install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.5.2'],
install_requires=['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.5.2'],
extras_require = {'docs':['sphinx'], extras_require = {'docs':['sphinx'],
'optional':['mpi4py', 'optional':['mpi4py',
'ipython>=4.0.0', 'ipython>=4.0.0',