Merge branch 'devel' into polinomial

This commit is contained in:
mzwiessele 2016-10-13 12:24:00 +01:00
commit 460757c048
10 changed files with 280 additions and 87 deletions

191
.gitchangelog.rc Normal file
View file

@ -0,0 +1,191 @@
##
## Format
##
## ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...]
##
## Description
##
## ACTION is one of 'chg', 'fix', 'new'
##
## Is WHAT the change is about.
##
## 'chg' is for refactor, small improvement, cosmetic changes...
## 'fix' is for bug fixes
## 'new' is for new features, big improvement
##
## AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc'
##
## Is WHO is concerned by the change.
##
## 'dev' is for developpers (API changes, refactors...)
## 'usr' is for final users (UI changes)
## 'pkg' is for packagers (packaging changes)
## 'test' is for testers (test only related changes)
## 'doc' is for doc guys (doc only changes)
##
## COMMIT_MSG is ... well ... the commit message itself.
##
## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic'
##
## They are preceded with a '!' or a '@' (prefer the former, as the
## latter is wrongly interpreted in github.) Commonly used tags are:
##
## 'refactor' is obviously for refactoring code only
## 'minor' is for a very meaningless change (a typo, adding a comment)
## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...)
## 'wip' is for partial functionality but complete subfunctionality.
##
## Example:
##
## new: usr: support of bazaar implemented
## chg: re-indentend some lines !cosmetic
## new: dev: updated code to be compatible with last version of killer lib.
## fix: pkg: updated year of licence coverage.
## new: test: added a bunch of test around user usability of feature X.
## fix: typo in spelling my name in comment. !minor
##
## Please note that multi-line commit message are supported, and only the
## first line will be considered as the "summary" of the commit message. So
## tags, and other rules only applies to the summary. The body of the commit
## message will be displayed in the changelog without reformatting.
##
## ``ignore_regexps`` is a line of regexps
##
## Any commit having its full commit message matching any regexp listed here
## will be ignored and won't be reported in the changelog.
##
ignore_regexps = [
r'@minor', r'!minor',
r'@cosmetic', r'!cosmetic',
r'@refactor', r'!refactor',
r'@wip', r'!wip',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
]
## ``section_regexps`` is a list of 2-tuples associating a string label and a
## list of regexp
##
## Commit messages will be classified in sections thanks to this. Section
## titles are the label, and a commit is classified under this section if any
## of the regexps associated is matching.
##
('New', [
r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Changes', [
r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Fix', [
r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
]),
('Other', None ## Match all lines
),
]
## ``body_process`` is a callable
##
## This callable will be given the original body and result will
## be used in the changelog.
##
## Available constructs are:
##
## - any python callable that take one txt argument and return txt argument.
##
## - ReSub(pattern, replacement): will apply regexp substitution.
##
## - Indent(chars=" "): will indent the text with the prefix
## Please remember that template engines gets also to modify the text and
## will usually indent themselves the text if needed.
##
## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns
##
## - noop: do nothing
##
## - ucfirst: ensure the first letter is uppercase.
## (usually used in the ``subject_process`` pipeline)
##
## - final_dot: ensure text finishes with a dot
## (usually used in the ``subject_process`` pipeline)
##
## - strip: remove any spaces before or after the content of the string
##
## Additionally, you can `pipe` the provided filters, for instance:
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
#body_process = noop
body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
## ``subject_process`` is a callable
##
## This callable will be given the original subject and result will
## be used in the changelog.
##
## Available constructs are those listed in ``body_process`` doc.
subject_process = (strip |
ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
ucfirst | final_dot)
## ``tag_filter_regexp`` is a regexp
##
## Tags that will be used for the changelog must match this regexp.
##
tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$'
## ``unreleased_version_label`` is a string
##
## This label will be used as the changelog Title of the last set of changes
## between last valid tag and HEAD if any.
unreleased_version_label = "Unreleased"
## ``output_engine`` is a callable
##
## This will change the output format of the generated changelog file
##
## Available choices are:
##
## - rest_py
##
## Legacy pure python engine, outputs ReSTructured text.
## This is the default.
##
## - mustache(<template_name>)
##
## Template name could be any of the available templates in
## ``templates/mustache/*.tpl``.
## Requires python package ``pystache``.
## Examples:
## - mustache("markdown")
## - mustache("restructuredtext")
##
## - makotemplate(<template_name>)
##
## Template name could be any of the available templates in
## ``templates/mako/*.tpl``.
## Requires python package ``mako``.
## Examples:
## - makotemplate("restructuredtext")
##
>>>>>>> 287584f0cdac51a674996ff6d7092cc876b25ce6
#output_engine = rest_py
#output_engine = mustache("restructuredtext")
output_engine = mustache("markdown")
#output_engine = makotemplate("restructuredtext")
## ``include_merge`` is a boolean
##
## This option tells git-log whether to include merge commits in the log.
## The default is to include them.
include_merge = True

View file

@ -1,13 +1,64 @@
# Changelog # Changelog
## v1.5.3 (2016-09-06) ## v1.5.5 (2016-10-03)
### Other ### Other
* Bump version: 1.5.4 → 1.5.5. [Max Zwiessele]
## v1.5.4 (2016-10-03)
### New
* Added deployment pull request instructions for developers. [mzwiessele]
* Using gitchangelog to keep track of changes and log new features. [mzwiessele]
### Changes
* Version update on paramz. [Max Zwiessele]
* Fixed naming in variational priors : [Max Zwiessele]
* Changelog update. [mzwiessele]
### Fix
* Bug in dataset (in fn download_url) which wrongly interprets the Content-Length meta data, and just takes first character. [Michael T Smith]
* What&#x27;s new update fix #425 in changelog. [mzwiessele]
### Other
* Bump version: 1.5.3 → 1.5.4. [Max Zwiessele]
* Merge pull request #443 from SheffieldML/dataset_download_url_bugfix. [Max Zwiessele]
fix: Bug in datasets.py
* Merge branch &#x27;kurtCutajar-devel&#x27; into devel. [mzwiessele]
* Bump version: 1.5.2 → 1.5.3. [mzwiessele] * Bump version: 1.5.2 → 1.5.3. [mzwiessele]
* Merge branch &#x27;devel&#x27; into kurtCutajar-devel. [mzwiessele] * Merge branch &#x27;devel&#x27; into kurtCutajar-devel. [mzwiessele]
* Bump version: 1.5.1 → 1.5.2. [mzwiessele]
* Minor readme changes. [mzwiessele]
* Bump version: 1.5.0 → 1.5.1. [mzwiessele]
* Bump version: 1.4.3 → 1.5.0. [mzwiessele]
* Bump version: 1.4.2 → 1.4.3. [mzwiessele]
* Bump version: 1.4.1 → 1.4.2. [mzwiessele]
* Merge branch &#x27;devel&#x27; of github.com:SheffieldML/GPy into devel. [mzwiessele]
* [kern] fix #440. [mzwiessele]
* [doc] cleanup. [mzwiessele] * [doc] cleanup. [mzwiessele]
* [merge] into new devel. [Max Zwiessele] * [merge] into new devel. [Max Zwiessele]
@ -41,63 +92,6 @@
* Added core code for GpSSM and GpGrid. [kcutajar] * Added core code for GpSSM and GpGrid. [kcutajar]
## v1.5.2 (2016-09-06)
### New
* Added deployment pull request instructions for developers. [mzwiessele]
### Other
* Bump version: 1.5.1 → 1.5.2. [mzwiessele]
* Minor readme changes. [mzwiessele]
## v1.5.1 (2016-09-06)
### Fix
* What&#x27;s new update fix #425 in changelog. [mzwiessele]
### Other
* Bump version: 1.5.0 → 1.5.1. [mzwiessele]
## v1.5.0 (2016-09-06)
### New
* Using gitchangelog to keep track of changes and log new features. [mzwiessele]
### Other
* Bump version: 1.4.3 → 1.5.0. [mzwiessele]
## v1.4.3 (2016-09-06)
### Changes
* Changelog update. [mzwiessele]
### Other
* Bump version: 1.4.2 → 1.4.3. [mzwiessele]
## v1.4.2 (2016-09-06)
### Other
* Bump version: 1.4.1 → 1.4.2. [mzwiessele]
* Merge branch &#x27;devel&#x27; of github.com:SheffieldML/GPy into devel. [mzwiessele]
* [kern] fix #440. [mzwiessele]
## v1.4.1 (2016-09-06) ## v1.4.1 (2016-09-06)
### Other ### Other
@ -718,6 +712,11 @@
* [coverage] some more restrictions. [Max Zwiessele] * [coverage] some more restrictions. [Max Zwiessele]
## v1.0.5 (2016-04-08)
### Other
* Merge pull request #365 from SheffieldML/devel. [Max Zwiessele] * Merge pull request #365 from SheffieldML/devel. [Max Zwiessele]
patch 1.0.5 patch 1.0.5

View file

@ -1 +1 @@
__version__ = "1.5.3" __version__ = "1.5.5"

View file

@ -10,7 +10,7 @@ from .param import Param
from paramz.transformations import Logexp, Logistic,__fixed__ from paramz.transformations import Logexp, Logistic,__fixed__
class VariationalPrior(Parameterized): class VariationalPrior(Parameterized):
def __init__(self, name='latent space', **kw): def __init__(self, name='latent prior', **kw):
super(VariationalPrior, self).__init__(name=name, **kw) super(VariationalPrior, self).__init__(name=name, **kw)
def KL_divergence(self, variational_posterior): def KL_divergence(self, variational_posterior):
@ -23,6 +23,9 @@ class VariationalPrior(Parameterized):
raise NotImplementedError("override this for variational inference of latent space") raise NotImplementedError("override this for variational inference of latent space")
class NormalPrior(VariationalPrior): class NormalPrior(VariationalPrior):
def __init__(self, name='normal_prior', **kw):
super(VariationalPrior, self).__init__(name=name, **kw)
def KL_divergence(self, variational_posterior): def KL_divergence(self, variational_posterior):
var_mean = np.square(variational_posterior.mean).sum() var_mean = np.square(variational_posterior.mean).sum()
var_S = (variational_posterior.variance - np.log(variational_posterior.variance)).sum() var_S = (variational_posterior.variance - np.log(variational_posterior.variance)).sum()
@ -58,7 +61,7 @@ class SpikeAndSlabPrior(VariationalPrior):
pi = self.pi[idx] pi = self.pi[idx]
else: else:
pi = self.pi pi = self.pi
var_mean = np.square(mu)/self.variance var_mean = np.square(mu)/self.variance
var_S = (S/self.variance - np.log(S)) var_S = (S/self.variance - np.log(S))
var_gamma = (gamma*np.log(gamma/pi)).sum()+((1-gamma)*np.log((1-gamma)/(1-pi))).sum() var_gamma = (gamma*np.log(gamma/pi)).sum()+((1-gamma)*np.log((1-gamma)/(1-pi))).sum()
@ -163,12 +166,12 @@ class NormalPosterior(VariationalPosterior):
"""Compute the KL divergence to another NormalPosterior Object. This only holds, if the two NormalPosterior objects have the same shape, as we do computational tricks for the multivariate normal KL divergence. """Compute the KL divergence to another NormalPosterior Object. This only holds, if the two NormalPosterior objects have the same shape, as we do computational tricks for the multivariate normal KL divergence.
""" """
return .5*( return .5*(
np.sum(self.variance/other.variance) np.sum(self.variance/other.variance)
+ ((other.mean-self.mean)**2/other.variance).sum() + ((other.mean-self.mean)**2/other.variance).sum()
- self.num_data * self.input_dim - self.num_data * self.input_dim
+ np.sum(np.log(other.variance)) - np.sum(np.log(self.variance)) + np.sum(np.log(other.variance)) - np.sum(np.log(self.variance))
) )
class SpikeAndSlabPosterior(VariationalPosterior): class SpikeAndSlabPosterior(VariationalPosterior):
''' '''
The SpikeAndSlab distribution for variational approximations. The SpikeAndSlab distribution for variational approximations.
@ -190,11 +193,11 @@ class SpikeAndSlabPosterior(VariationalPosterior):
else: else:
self.gamma = Param("binary_prob",binary_prob,Logistic(1e-10,1.-1e-10)) self.gamma = Param("binary_prob",binary_prob,Logistic(1e-10,1.-1e-10))
self.link_parameter(self.gamma) self.link_parameter(self.gamma)
def propogate_val(self): def propogate_val(self):
if self.group_spike: if self.group_spike:
self.gamma.values[:] = self.gamma_group.values self.gamma.values[:] = self.gamma_group.values
def collate_gradient(self): def collate_gradient(self):
if self.group_spike: if self.group_spike:
self.gamma_group.gradient = self.gamma.gradient.reshape(self.gamma.shape).sum(axis=0) self.gamma_group.gradient = self.gamma.gradient.reshape(self.gamma.shape).sum(axis=0)

View file

@ -3,7 +3,6 @@
import sys import sys
import numpy as np import numpy as np
from ...core.parameterization.parameterized import Parameterized from ...core.parameterization.parameterized import Parameterized
from paramz.core.observable_array import ObsAr
from paramz.caching import Cache_this from paramz.caching import Cache_this
from .kernel_slice_operations import KernCallsViaSlicerMeta from .kernel_slice_operations import KernCallsViaSlicerMeta
from functools import reduce from functools import reduce

View file

@ -42,6 +42,7 @@ class RBF(Stationary):
def dK2_drdr_diag(self): def dK2_drdr_diag(self):
return -self.variance # as the diagonal of r is always filled with zeros return -self.variance # as the diagonal of r is always filled with zeros
def __getstate__(self): def __getstate__(self):
dc = super(RBF, self).__getstate__() dc = super(RBF, self).__getstate__()
if self.useGPU: if self.useGPU:

View file

@ -13,9 +13,9 @@ The Gaussian processes framework in Python.
## What's new: ## What's new:
From now on we keep track of changes in the CHANGELOG.md. From now on we keep track of changes in the CHANGELOG.md.
If you want your changes to show up there follow the [guidelines](#gl). If you want your changes to show up there follow the [guidelines](#gl).
In particular tag your commits by the [gitchangelog](https://github.com/vaab/gitchangelog) commit message format. In particular tag your commits by the [gitchangelog](https://github.com/vaab/gitchangelog) commit message format.
## Contributing to GPy ## Contributing to GPy
@ -33,7 +33,7 @@ For an in depth description of pull requests, please visit https://help.github.c
6. The tests will be running on your pull request. In the comments section we will be able to discuss the changes and help you with any problems. Let us know if there are any in the comments, so we can help. 6. The tests will be running on your pull request. In the comments section we will be able to discuss the changes and help you with any problems. Let us know if there are any in the comments, so we can help.
7. The pull request gets accepted and your awsome new feature will be in the next GPy release :) 7. The pull request gets accepted and your awsome new feature will be in the next GPy release :)
For any further questions/suggestions head over to the issues section in GPy. For any further questions/suggestions head over to the issues section in GPy.
<a name=gl></a> <a name=gl></a>
### Pull Request Guidelines ### Pull Request Guidelines
@ -126,14 +126,14 @@ If you're having trouble installing GPy via `pip install GPy` here is a probable
# Saving models in a consistent way across versions: # Saving models in a consistent way across versions:
As pickle is inconsistent across python versions and heavily dependent on class structure, it behaves inconsistent across versions. As pickle is inconsistent across python versions and heavily dependent on class structure, it behaves inconsistent across versions.
Pickling as meant to serialize models within the same environment, and not to store models on disk to be used later on. Pickling as meant to serialize models within the same environment, and not to store models on disk to be used later on.
To save a model it is best to save the m.param_array of it to disk (using numpys np.save). To save a model it is best to save the m.param_array of it to disk (using numpys np.save).
Additionally, you save the script, which creates the model. Additionally, you save the script, which creates the model.
In this script you can create the model using initialize=False as a keyword argument and with the data loaded as normal. In this script you can create the model using initialize=False as a keyword argument and with the data loaded as normal.
You then set the model parameters by setting m.param_array[:] = loaded_params as the previously saved parameters. You then set the model parameters by setting m.param_array[:] = loaded_params as the previously saved parameters.
Then you initialize the model by m.initialize_parameter(), which will make the model usable. Then you initialize the model by m.initialize_parameter(), which will make the model usable.
Be aware that up to this point the model is in an inconsistent state and cannot be used to produce any results. Be aware that up to this point the model is in an inconsistent state and cannot be used to produce any results.
```python ```python
@ -161,15 +161,15 @@ New way of running tests is using coverage:
Ensure nose and coverage is installed: Ensure nose and coverage is installed:
pip install nose coverage pip install nose coverage
Run nosetests from root directory of repository: Run nosetests from root directory of repository:
coverage run travis_tests.py coverage run travis_tests.py
Create coverage report in htmlcov/ Create coverage report in htmlcov/
coverage html coverage html
The coverage report is located in htmlcov/index.html The coverage report is located in htmlcov/index.html
##### Legacy: using nosetests ##### Legacy: using nosetests
@ -223,7 +223,7 @@ If you want to merge a branch into devel make sure the following steps are met:
- Check that tests are there and are checking code where applicable. - Check that tests are there and are checking code where applicable.
- [optional] Make changes if necessary and commit and push to run tests. - [optional] Make changes if necessary and commit and push to run tests.
- [optional] Repeat the above until tests pass. - [optional] Repeat the above until tests pass.
- [optional] bump up the version of GPy using bumpversion. The configuration is done, so all you need is bumpversion [major|minor|patch]. - [optional] bump up the version of GPy using bumpversion. The configuration is done, so all you need is bumpversion [major|minor|patch].
- Update the changelog using gitchangelog: `gitchangelog > CHANGELOG.md` - Update the changelog using gitchangelog: `gitchangelog > CHANGELOG.md`
- Commit the changes of the changelog as silent update: `git commit -m "chg: pkg: CHANGELOG update" CHANGELOG.md - Commit the changes of the changelog as silent update: `git commit -m "chg: pkg: CHANGELOG update" CHANGELOG.md
- Push the changes into devel. - Push the changes into devel.
@ -246,16 +246,16 @@ Then we are ready to make the last changes for the changelog and versioning:
Now we can merge the pull request into devel: Now we can merge the pull request into devel:
$ git checkout devel $ git checkout devel
$ git merge --no-ff kurtCutajar-devel $ git merge --no-ff <pull-origin>-devel
$ git push origin devel $ git push origin devel
This will update the devel branch of GPy. This will update the devel branch of GPy.
### Deploying GPy ### Deploying GPy
We have set up all deployment automatic. We have set up all deployment automatic.
Thus, all you need to do is create a pull request from devel to deploy. Thus, all you need to do is create a pull request from devel to deploy.
Wait for the tests to finish (successfully!) and merge the pull request. Wait for the tests to finish (successfully!) and merge the pull request.
This will update the package on pypi for all platforms fully automatically. This will update the package on pypi for all platforms fully automatically.
## Funding Acknowledgements ## Funding Acknowledgements

View file

@ -3,7 +3,7 @@ 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.5.3 gpy_version: 1.5.5
matrix: matrix:
- PYTHON_VERSION: 2.7 - PYTHON_VERSION: 2.7
MINICONDA: C:\Miniconda-x64 MINICONDA: C:\Miniconda-x64

View file

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 1.5.3 current_version = 1.5.5
tag = True tag = True
commit = True commit = True

View file

@ -148,7 +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',
install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.6.8'], install_requires = ['numpy>=1.7', 'scipy>=0.16', 'six', 'paramz>=0.6.9'],
extras_require = {'docs':['sphinx'], extras_require = {'docs':['sphinx'],
'optional':['mpi4py', 'optional':['mpi4py',
'ipython>=4.0.0', 'ipython>=4.0.0',