From bd4d76c27e591402cfe05ceab67d7b3003285369 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Thu, 26 Mar 2020 11:11:37 +0000 Subject: [PATCH 01/43] ignore itermediary sphinx restructured text --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3f15a070..9af82ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ iterate.dat # pycharm IDE stuff .idea/ + +# docs +GPy*.rst \ No newline at end of file From 9463e61e063ff761a6b0d390fca1f5be6fe9d216 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Thu, 26 Mar 2020 11:30:58 +0000 Subject: [PATCH 02/43] ignore vs code project settings file --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9af82ff5..950eecdd 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,7 @@ iterate.dat .idea/ # docs -GPy*.rst \ No newline at end of file +GPy*.rst + +# vscode +settings.json \ No newline at end of file From 36d41a4860ecd2f591e901e78ad5375c0ed486bb Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 27 Mar 2020 10:01:35 +0000 Subject: [PATCH 03/43] add yml config for readthedocs --- .readthedocs.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..5a7c9cd3 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.7 + install: + - requirements: doc/source/requirements.txt \ No newline at end of file From a6819de25c5168a51c2dfec6dd7279fe7c6a2aaa Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 27 Mar 2020 10:09:16 +0000 Subject: [PATCH 04/43] correct path --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5a7c9cd3..8bdf2f99 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,7 +7,7 @@ version: 2 # Build documentation in the docs/ directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: doc/source/conf.py # Build documentation with MkDocs #mkdocs: From f1572467ec7254c2168ec806bb076f1b2825ef00 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 27 Mar 2020 13:31:27 +0000 Subject: [PATCH 05/43] drop epub and pdf builds (as per main GPy) --- .readthedocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 8bdf2f99..eda0c9a0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,8 @@ sphinx: # configuration: mkdocs.yml # Optionally build your docs in additional formats such as PDF and ePub -formats: all +formats: + -htmlzip # Optionally set the version of Python and requirements required to build your docs python: From dbe28733dc46ea4f7286a6830703217388ee301e Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 27 Mar 2020 13:32:42 +0000 Subject: [PATCH 06/43] typo --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index eda0c9a0..36eef22f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -15,7 +15,7 @@ sphinx: # Optionally build your docs in additional formats such as PDF and ePub formats: - -htmlzip + - htmlzip # Optionally set the version of Python and requirements required to build your docs python: From 61fb5e2bbe8cf166483c103d0bfa3473d53a542d Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Mon, 30 Mar 2020 11:07:53 +0100 Subject: [PATCH 07/43] headings and structure --- doc/source/index.rst | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 0994536d..1044d1dc 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,10 +1,8 @@ -.. GPy documentation master file, created by - sphinx-quickstart on Fri Sep 18 18:16:28 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +GPy - A Gaussian Process (GP) framework in Python +================================================= -Welcome to GPy's documentation! -=============================== +Introduction +------------ `GPy `_ is a Gaussian Process (GP) framework written in Python, from the Sheffield machine learning group. @@ -13,14 +11,19 @@ This documentation is mostly aimed at developers interacting closely with the co The code can be found on our `Github project page `_. It is open source and provided under the BSD license. -For developers: +Installation +------------ + +For developers +-------------- - `Writing new models `_ - `Writing new kernels `_ - `Write a new plotting routine using gpy_plot `_ - `Parameterization handles `_ -Contents: +API Documentation +----------------- .. toctree:: :maxdepth: 1 @@ -40,7 +43,7 @@ Contents: GPy.inference.mcmc Indices and tables -================== +------------------ * :ref:`genindex` * :ref:`modindex` From a70f9a6a95aefc2a3e972f7e018faed0e2193509 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Mon, 30 Mar 2020 11:10:11 +0100 Subject: [PATCH 08/43] update copyright --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index b968fe48..533417bb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -134,7 +134,7 @@ master_doc = 'index' project = u'GPy' #author = u'`Humans `_' author = 'GPy Authors, see https://github.com/SheffieldML/GPy/graphs/contributors' -copyright = u'2015, '+author +copyright = u'2020, '+author # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the From 8c8fb4cb2b6a5fa26d51e8a528ad6769230f1688 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Mon, 30 Mar 2020 14:58:59 +0100 Subject: [PATCH 09/43] restructuring and smartening --- doc/source/index.rst | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 1044d1dc..f99dd356 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,29 +4,39 @@ GPy - A Gaussian Process (GP) framework in Python Introduction ------------ -`GPy `_ is a Gaussian Process (GP) framework written in Python, from the Sheffield machine learning group. +`GPy `_ is a Gaussian Process (GP) framework written in Python, from the Sheffield machine learning group. It includes support for basic GP regression, multiple output GPs (using coregionalization), various noise models, sparse GPs, non-parametric regression and latent variables. The `GPy homepage `_ contains tutorials for users and further information on the project, including installation instructions. -This documentation is mostly aimed at developers interacting closely with the code-base. + +The documentation hosted here is mostly aimed at developers interacting closely with the code-base. + +Source Code +----------- The code can be found on our `Github project page `_. It is open source and provided under the BSD license. Installation ------------ -For developers --------------- +Installation instructions can currently be found on our `Github project page `_. -- `Writing new models `_ -- `Writing new kernels `_ -- `Write a new plotting routine using gpy_plot `_ -- `Parameterization handles `_ +Tutorials +--------- -API Documentation ------------------ +Several tutorials have been developed in the form of `Jupyter Notebooks `_. .. toctree:: :maxdepth: 1 + :caption: For developers + + tuto_creating_new_models + tuto_creating_new_kernels + tuto_plotting + tuto_parameterized + +.. toctree:: + :maxdepth: 1 + :caption: API Documentation GPy.models GPy.kern From b6dbac6c124ac152acaa8530b6249eb989f906cf Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Mon, 30 Mar 2020 14:59:14 +0100 Subject: [PATCH 10/43] remove dead links --- doc/source/index.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index f99dd356..6ae53eb1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -51,11 +51,4 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Wed, 1 Apr 2020 12:45:08 +0100 Subject: [PATCH 11/43] reorder package docs --- GPy/models/__init__.py | 8 ++++++++ doc/source/conf.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/GPy/models/__init__.py b/GPy/models/__init__.py index 3e788927..4eedf2b1 100644 --- a/GPy/models/__init__.py +++ b/GPy/models/__init__.py @@ -1,6 +1,14 @@ # Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) +""" +This module does... + +.. automodule:: .src + :members: + :private-members: +""" + from .gp_regression import GPRegression from .gp_classification import GPClassification from .sparse_gp_regression import SparseGPRegression diff --git a/doc/source/conf.py b/doc/source/conf.py index 533417bb..079573b3 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -64,7 +64,7 @@ if on_rtd: print(out) #Lets regenerate our rst files from the source, -P adds private modules (i.e kern._src) - proc = subprocess.Popen("sphinx-apidoc -P -f -o . ../../GPy", stdout=subprocess.PIPE, shell=True) + proc = subprocess.Popen("sphinx-apidoc -M -P -f -o . ../../GPy", stdout=subprocess.PIPE, shell=True) (out, err) = proc.communicate() print("$ Apidoc:") print(out) From 680fd29ba4f42cba5e8878f719b1226b78e1568c Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Thu, 2 Apr 2020 15:51:41 +0100 Subject: [PATCH 12/43] rst "markup" --- .../gp_kronecker_gaussian_regression.py | 13 +++---- GPy/models/gp_multiout_regression.py | 7 ++-- GPy/models/gp_multiout_regression_md.py | 8 +++-- GPy/models/gp_var_gauss.py | 10 ++---- GPy/models/gradient_checker.py | 34 ++++++++++--------- GPy/plotting/gpy_plot/latent_plots.py | 21 ++++++++---- 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/GPy/models/gp_kronecker_gaussian_regression.py b/GPy/models/gp_kronecker_gaussian_regression.py index 44177b16..a8addf73 100644 --- a/GPy/models/gp_kronecker_gaussian_regression.py +++ b/GPy/models/gp_kronecker_gaussian_regression.py @@ -18,14 +18,11 @@ class GPKroneckerGaussianRegression(Model): The noise must be iid Gaussian. - See Stegle et al. - @inproceedings{stegle2011efficient, - title={Efficient inference in matrix-variate gaussian models with $\\backslash$ iid observation noise}, - author={Stegle, Oliver and Lippert, Christoph and Mooij, Joris M and Lawrence, Neil D and Borgwardt, Karsten M}, - booktitle={Advances in Neural Information Processing Systems}, - pages={630--638}, - year={2011} - } + See [stegle_et_al_2011]_. + + .. rubric:: References + + .. [stegle_et_al_2011] Stegle, O.; Lippert, C.; Mooij, J.M.; Lawrence, N.D.; Borgwardt, K.:Efficient inference in matrix-variate Gaussian models with \iid observation noise. In: Advances in Neural Information Processing Systems, 2011, Pages 630-638 """ def __init__(self, X1, X2, Y, kern1, kern2, noise_var=1., name='KGPR'): diff --git a/GPy/models/gp_multiout_regression.py b/GPy/models/gp_multiout_regression.py index ede6095e..816fc0d7 100644 --- a/GPy/models/gp_multiout_regression.py +++ b/GPy/models/gp_multiout_regression.py @@ -15,9 +15,11 @@ class GPMultioutRegression(SparseGP): """ Gaussian Process model for multi-output regression without missing data - This is an implementation of Latent Variable Multiple Output Gaussian Processes (LVMOGP) in [Dai et al. 2017]. + This is an implementation of Latent Variable Multiple Output Gaussian Processes (LVMOGP) in [Dai_et_al_2017]_. - Zhenwen Dai, Mauricio A. Alvarez and Neil D. Lawrence. Efficient Modeling of Latent Information in Supervised Learning using Gaussian Processes. In NIPS, 2017. + .. rubric:: References + + .. [Dai_et_al_2017] Dai, Z.; Alvarez, M.A.; Lawrence, N.D: Efficient Modeling of Latent Information in Supervised Learning using Gaussian Processes. In NIPS, 2017. :param X: input observations. :type X: numpy.ndarray @@ -42,6 +44,7 @@ class GPMultioutRegression(SparseGP): :param int qU_var_c_W_dim: the dimensionality of the covariance of q(U) for the GP regression. If it is smaller than the number of inducing points, it represents a low-rank parameterization of the covariance matrix. :param str init: the choice of initialization: 'GP' or 'rand'. With 'rand', the model is initialized randomly. With 'GP', the model is initialized through a protocol as follows: (1) fits a sparse GP (2) fits a BGPLVM based on the outcome of sparse GP (3) initialize the model based on the outcome of the BGPLVM. :param str name: the name of the model + """ def __init__(self, X, Y, Xr_dim, kernel=None, kernel_row=None, Z=None, Z_row=None, X_row=None, Xvariance_row=None, num_inducing=(10,10), qU_var_r_W_dim=None, qU_var_c_W_dim=None, init='GP', name='GPMR'): diff --git a/GPy/models/gp_multiout_regression_md.py b/GPy/models/gp_multiout_regression_md.py index 36d24c48..3eb91114 100644 --- a/GPy/models/gp_multiout_regression_md.py +++ b/GPy/models/gp_multiout_regression_md.py @@ -16,9 +16,11 @@ class GPMultioutRegressionMD(SparseGP): """ Gaussian Process model for multi-output regression with missing data - This is an implementation of Latent Variable Multiple Output Gaussian Processes (LVMOGP) in [Dai et al. 2017]. This model targets at the use case, in which each output dimension is observed at a different set of inputs. The model takes a different data format: the inputs and outputs observations of all the output dimensions are stacked together correspondingly into two matrices. An extra array is used to indicate the index of output dimension for each data point. The output dimensions are indexed using integers from 0 to D-1 assuming there are D output dimensions. + This is an implementation of Latent Variable Multiple Output Gaussian Processes (LVMOGP) in [Dai_et_al_2017]_. This model targets at the use case, in which each output dimension is observed at a different set of inputs. The model takes a different data format: the inputs and outputs observations of all the output dimensions are stacked together correspondingly into two matrices. An extra array is used to indicate the index of output dimension for each data point. The output dimensions are indexed using integers from 0 to D-1 assuming there are D output dimensions. - Zhenwen Dai, Mauricio A. Alvarez and Neil D. Lawrence. Efficient Modeling of Latent Information in Supervised Learning using Gaussian Processes. In NIPS, 2017. + .. rubric:: References + + .. [Dai_et_al_2017] Dai, Z.; Alvarez, M.A.; Lawrence, N.D: Efficient Modeling of Latent Information in Supervised Learning using Gaussian Processes. In NIPS, 2017. :param X: input observations. :type X: numpy.ndarray @@ -46,6 +48,8 @@ class GPMultioutRegressionMD(SparseGP): :param str init: the choice of initialization: 'GP' or 'rand'. With 'rand', the model is initialized randomly. With 'GP', the model is initialized through a protocol as follows: (1) fits a sparse GP (2) fits a BGPLVM based on the outcome of sparse GP (3) initialize the model based on the outcome of the BGPLVM. :param boolean heter_noise: whether assuming heteroscedastic noise in the model, boolean :param str name: the name of the model + + """ def __init__(self, X, Y, indexD, Xr_dim, kernel=None, kernel_row=None, Z=None, Z_row=None, X_row=None, Xvariance_row=None, num_inducing=(10,10), qU_var_r_W_dim=None, qU_var_c_W_dim=None, init='GP', heter_noise=False, name='GPMRMD'): diff --git a/GPy/models/gp_var_gauss.py b/GPy/models/gp_var_gauss.py index 4c8fa7ef..6a61b604 100644 --- a/GPy/models/gp_var_gauss.py +++ b/GPy/models/gp_var_gauss.py @@ -13,13 +13,9 @@ class GPVariationalGaussianApproximation(GP): """ The Variational Gaussian Approximation revisited - @article{Opper:2009, - title = {The Variational Gaussian Approximation Revisited}, - author = {Opper, Manfred and Archambeau, C{\'e}dric}, - journal = {Neural Comput.}, - year = {2009}, - pages = {786--792}, - } + .. rubric:: References + + .. [opper_archambeau_2009] Opper, M.; Archambeau, C.; The Variational Gaussian Approximation Revisited. Neural Comput. 2009, pages 786-792. """ def __init__(self, X, Y, kernel, likelihood, Y_metadata=None): diff --git a/GPy/models/gradient_checker.py b/GPy/models/gradient_checker.py index f7c17376..904b88c6 100644 --- a/GPy/models/gradient_checker.py +++ b/GPy/models/gradient_checker.py @@ -39,28 +39,30 @@ class GradientChecker(Model): a list of names with the same length is expected. :param args: Arguments passed as f(x, *args, **kwargs) and df(x, *args, **kwargs) - Examples: - --------- + .. rubric:: Examples + + Initialisation:: + from GPy.models import GradientChecker N, M, Q = 10, 5, 3 - Sinusoid: + Sinusoid:: - X = numpy.random.rand(N, Q) - grad = GradientChecker(numpy.sin,numpy.cos,X,'x') - grad.checkgrad(verbose=1) + X = numpy.random.rand(N, Q) + grad = GradientChecker(numpy.sin,numpy.cos,X,'x') + grad.checkgrad(verbose=1) - Using GPy: + Using GPy:: - X, Z = numpy.random.randn(N,Q), numpy.random.randn(M,Q) - kern = GPy.kern.linear(Q, ARD=True) + GPy.kern.rbf(Q, ARD=True) - grad = GradientChecker(kern.K, - lambda x: 2*kern.dK_dX(numpy.ones((1,1)), x), - x0 = X.copy(), - names='X') - grad.checkgrad(verbose=1) - grad.randomize() - grad.checkgrad(verbose=1) + X, Z = numpy.random.randn(N,Q), numpy.random.randn(M,Q) + kern = GPy.kern.linear(Q, ARD=True) + GPy.kern.rbf(Q, ARD=True) + grad = GradientChecker(kern.K, + lambda x: 2*kern.dK_dX(numpy.ones((1,1)), x), + x0 = X.copy(), + names='X') + grad.checkgrad(verbose=1) + grad.randomize() + grad.checkgrad(verbose=1) """ super(GradientChecker, self).__init__(name='GradientChecker') if isinstance(x0, (list, tuple)) and names is None: diff --git a/GPy/plotting/gpy_plot/latent_plots.py b/GPy/plotting/gpy_plot/latent_plots.py index f76fda1c..a749f0c1 100644 --- a/GPy/plotting/gpy_plot/latent_plots.py +++ b/GPy/plotting/gpy_plot/latent_plots.py @@ -89,7 +89,8 @@ def plot_latent_scatter(self, labels=None, Plot a scatter plot of the latent space. :param array-like labels: a label for each data point (row) of the inputs - :param (int, int) which_indices: which input dimensions to plot against each other + :param which_indices: which input dimensions to plot against each other + :type which_indices: (int, int) :param bool legend: whether to plot the legend on the figure :param plot_limits: the plot limits for the plot :type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ymax)) @@ -174,7 +175,8 @@ def plot_magnification(self, labels=None, which_indices=None, density of the GP as a gray scale. :param array-like labels: a label for each data point (row) of the inputs - :param (int, int) which_indices: which input dimensions to plot against each other + :param which_indices: which input dimensions to plot against each other + :type which_indices: (int, int) :param int resolution: the resolution at which we predict the magnification factor :param str marker: markers to use - cycle if more labels then markers are given :param bool legend: whether to plot the legend on the figure @@ -183,7 +185,8 @@ def plot_magnification(self, labels=None, which_indices=None, :param bool updates: if possible, make interactive updates using the specific library you are using :param bool mean: use the mean of the Wishart embedding for the magnification factor :param bool covariance: use the covariance of the Wishart embedding for the magnification factor - :param :py:class:`~GPy.kern.Kern` kern: the kernel to use for prediction + :param kern: the kernel to use for prediction + :type kern: :py:class:`~GPy.kern.Kern` :param int num_samples: the number of samples to plot maximally. We do a stratified subsample from the labels, if the number of samples (in X) is higher then num_samples. :param imshow_kwargs: the kwargs for the imshow (magnification factor) :param kwargs: the kwargs for the scatter plots @@ -248,13 +251,15 @@ def plot_latent(self, labels=None, which_indices=None, scatter plot of the input dimemsions selected by which_indices. :param array-like labels: a label for each data point (row) of the inputs - :param (int, int) which_indices: which input dimensions to plot against each other + :param which_indices: which input dimensions to plot against each other + :type which_indices: (int, int) :param int resolution: the resolution at which we predict the magnification factor :param bool legend: whether to plot the legend on the figure :param plot_limits: the plot limits for the plot :type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ymax)) :param bool updates: if possible, make interactive updates using the specific library you are using - :param :py:class:`~GPy.kern.Kern` kern: the kernel to use for prediction + :param kern: the kernel to use for prediction + :type kern: :py:class:`~GPy.kern.Kern` :param str marker: markers to use - cycle if more labels then markers are given :param int num_samples: the number of samples to plot maximally. We do a stratified subsample from the labels, if the number of samples (in X) is higher then num_samples. :param imshow_kwargs: the kwargs for the imshow (magnification factor) @@ -316,13 +321,15 @@ def plot_steepest_gradient_map(self, output_labels=None, data_labels=None, which scatter plot of the input dimemsions selected by which_indices. :param array-like labels: a label for each data point (row) of the inputs - :param (int, int) which_indices: which input dimensions to plot against each other + :param which_indices: which input dimensions to plot against each other + :type which_indices: (int, int) :param int resolution: the resolution at which we predict the magnification factor :param bool legend: whether to plot the legend on the figure, if int plot legend columns on legend :param plot_limits: the plot limits for the plot :type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ymax)) :param bool updates: if possible, make interactive updates using the specific library you are using - :param :py:class:`~GPy.kern.Kern` kern: the kernel to use for prediction + :param kern: the kernel to use for prediction + :type kern: :py:class:`~GPy.kern.Kern` :param str marker: markers to use - cycle if more labels then markers are given :param int num_samples: the number of samples to plot maximally. We do a stratified subsample from the labels, if the number of samples (in X) is higher then num_samples. :param imshow_kwargs: the kwargs for the imshow (magnification factor) From 3375458dbb516f07f3fcda4d4409ca1cb9d898f7 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 3 Apr 2020 09:26:43 +0100 Subject: [PATCH 13/43] change rst syntax --- GPy/core/gp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index 1a06f088..66d62f62 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -335,7 +335,7 @@ class GP(Model): of the output dimensions. Note: If you want the predictive quantiles (e.g. 95% confidence - interval) use :py:func:"~GPy.core.gp.GP.predict_quantiles". + interval) use :py:func:`~GPy.core.gp.GP.predict_quantiles`. """ # Predict the latent function values @@ -384,7 +384,7 @@ class GP(Model): If full_cov and self.input_dim > 1, the return shape of var is Nnew x Nnew x self.input_dim. If self.input_dim == 1, the return shape is Nnew x Nnew. This is to allow for different normalizations of the output dimensions. - Note: If you want the predictive quantiles (e.g. 95% confidence interval) use :py:func:"~GPy.core.gp.GP.predict_quantiles". + Note: If you want the predictive quantiles (e.g. 95% confidence interval) use :py:func:`~GPy.core.gp.GP.predict_quantiles`. """ return self.predict(Xnew, full_cov, Y_metadata, kern, None, False) From a312e754bd9d366817f42bfb9f8befd5c4bf522b Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 3 Apr 2020 10:11:44 +0100 Subject: [PATCH 14/43] makes sense for core to go first --- doc/source/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 6ae53eb1..b974acd3 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -38,6 +38,8 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Fri, 3 Apr 2020 10:14:11 +0100 Subject: [PATCH 15/43] add placeholder --- GPy/core/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GPy/core/__init__.py b/GPy/core/__init__.py index 49e9c3c7..6f466652 100644 --- a/GPy/core/__init__.py +++ b/GPy/core/__init__.py @@ -1,6 +1,11 @@ # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) +""" +This module does... + +""" + from GPy.core.model import Model from .parameterization import Param, Parameterized from . import parameterization From 59a7742a9cd7b1bac7c33bc8770a45001bc85f11 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 3 Apr 2020 16:45:24 +0100 Subject: [PATCH 16/43] initial core docs, class diagram --- GPy/core/__init__.py | 16 +++++++++++++++- doc/source/architecture.rst | 4 ++++ doc/source/conf.py | 5 +++++ doc/source/index.rst | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 doc/source/architecture.rst diff --git a/GPy/core/__init__.py b/GPy/core/__init__.py index 6f466652..45113474 100644 --- a/GPy/core/__init__.py +++ b/GPy/core/__init__.py @@ -2,7 +2,21 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) """ -This module does... +This module contains the fundamental classes of GPy - classes that are inherited by objects in other parts of GPy in order to provide a consistent interface to major functionality. + +.. inheritance-diagram:: GPy.core.gp.GP + :top-classes: paramz.core.parameter_core.Parameterizable + +:py:class:`GPy.core.model` is inherited by :py:class:`GPy.core.gp.GP`. And :py:class:`GPy.core.model` itself inherits :py:class:`paramz.model.Model` from the `paramz` package. `paramz` essentially provides an inherited set of properties and functions used to manage state (and state changes) of the model. + +:py:class:`GPy.core.gp.GP` represents a GP model. Such an entity is typically passed variables representing known (x) and observed (y) data, along with a kernel and other information needed to create the specific model. It exposes functions which return information derived from the inputs to the model, for example predicting unobserved variables based on new known variables, or the log marginal likelihood of the current state of the model. + +:py:func:`~GPy.core.gp.GP.optimize` is called to optimize hyperparameters of the model. The optimizer argument takes a string which is used to specify non-default optimization schemes. + +Various plotting functions can be called against :py:class:`GPy.core.gp.GP`. + +:py:class:`GPy.core.gp.GP` is inherited by :py:class:`GPy.core.gp_grid`, :py:class:`GPy.core.sparse_gp`, different types of GP model. + """ diff --git a/doc/source/architecture.rst b/doc/source/architecture.rst new file mode 100644 index 00000000..b63166aa --- /dev/null +++ b/doc/source/architecture.rst @@ -0,0 +1,4 @@ +GPy Project Architecture +======================== + + diff --git a/doc/source/conf.py b/doc/source/conf.py index 079573b3..b1cea5eb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -83,8 +83,13 @@ extensions = [ #'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', + 'sphinx.ext.graphviz', + 'sphinx.ext.inheritance_diagram', ] +#---sphinx.ext.inheritance_diagram config +inheritance_graph_attrs = dict(rankdir="TB") + #----- Autodoc #import sys #try: diff --git a/doc/source/index.rst b/doc/source/index.rst index b974acd3..61a605d9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -25,6 +25,12 @@ Tutorials Several tutorials have been developed in the form of `Jupyter Notebooks `_. +.. toctree:: + :maxdepth: 1 + :caption: Architecture + + architecture + .. toctree:: :maxdepth: 1 :caption: For developers From 66015895a72cd2550d3f8ab1a4c60bc48b883dcf Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 11:46:47 +0100 Subject: [PATCH 17/43] lower level detail --- GPy/core/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPy/core/__init__.py b/GPy/core/__init__.py index 45113474..f2dc4904 100644 --- a/GPy/core/__init__.py +++ b/GPy/core/__init__.py @@ -2,6 +2,9 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) """ +Introduction +^^^^^^^^^^^^ + This module contains the fundamental classes of GPy - classes that are inherited by objects in other parts of GPy in order to provide a consistent interface to major functionality. .. inheritance-diagram:: GPy.core.gp.GP @@ -15,8 +18,10 @@ This module contains the fundamental classes of GPy - classes that are inherited Various plotting functions can be called against :py:class:`GPy.core.gp.GP`. -:py:class:`GPy.core.gp.GP` is inherited by :py:class:`GPy.core.gp_grid`, :py:class:`GPy.core.sparse_gp`, different types of GP model. +.. inheritance-diagram:: GPy.core.gp_grid.GpGrid GPy.core.sparse_gp.SparseGP GPy.core.sparse_gp_mpi.SparseGP_MPI GPy.core.svgp.SVGP + :top-classes: GPy.core.gp.GP +:py:class:`GPy.core.gp.GP` is used as the basis for classes supporting more specialized types of Gaussian Process model. These are however generally still not specific enough to be called by the user and are inhereted by members of the :py:class:`GPy.models` package. """ From 14cfd95be88d1344bb50fe94a42eafa2019f67a7 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 08:54:33 +0100 Subject: [PATCH 18/43] higher res diagrams --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index b1cea5eb..38055b64 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -88,7 +88,7 @@ extensions = [ ] #---sphinx.ext.inheritance_diagram config -inheritance_graph_attrs = dict(rankdir="TB") +inheritance_graph_attrs = dict(rankdir="TB", dpi=1200) #----- Autodoc #import sys From 0e8fcfa3195f7208c1a82ae20d347de2dc9b2162 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 08:33:24 +0100 Subject: [PATCH 19/43] layout changes for diagrams resolve conflict --- doc/source/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 38055b64..28ea3264 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -88,7 +88,7 @@ extensions = [ ] #---sphinx.ext.inheritance_diagram config -inheritance_graph_attrs = dict(rankdir="TB", dpi=1200) +inheritance_graph_attrs = dict(rankdir="LR", dpi=1200) #----- Autodoc #import sys @@ -250,6 +250,9 @@ html_theme = 'sphinx_rtd_theme' # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +def setup(app): + app.add_stylesheet('wide.css') + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. From 3b67ecfe307be7db19721f2a1ffeb9172c5d3049 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 08:40:34 +0100 Subject: [PATCH 20/43] better syntax --- doc/source/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 28ea3264..5fe9be77 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -250,8 +250,9 @@ html_theme = 'sphinx_rtd_theme' # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -def setup(app): - app.add_stylesheet('wide.css') +html_css_files = [ + 'wide.css', +] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied From b39895644e38d595720a2f063850000a87205657 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 16:34:06 +0100 Subject: [PATCH 21/43] redunant block --- GPy/models/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/GPy/models/__init__.py b/GPy/models/__init__.py index 4eedf2b1..88091ca9 100644 --- a/GPy/models/__init__.py +++ b/GPy/models/__init__.py @@ -4,9 +4,7 @@ """ This module does... -.. automodule:: .src - :members: - :private-members: + """ from .gp_regression import GPRegression From f2f1c0d7ff8db2b0edce3731661d268300d04939 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 17 Apr 2020 16:43:57 +0100 Subject: [PATCH 22/43] introduction --- GPy/models/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPy/models/__init__.py b/GPy/models/__init__.py index 88091ca9..9797f494 100644 --- a/GPy/models/__init__.py +++ b/GPy/models/__init__.py @@ -2,7 +2,10 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) """ -This module does... +Introduction +^^^^^^^^^^^^ + +This package principally contains classes ultimately inherited from :py:class:`GPy.core.gp.GP` intended as models for end user consuption - much of :py:class:`GPy.core.gp.GP` is not intended to be called directly. Some of these fall into conceptually related groups of models (e.g. :py:class:`GPy.core.sparse_gp`, :py:class:`GPy.core.sparse_gp_mpi`). """ From 1d97744cf6f02de87b5c4499d925517e019c3773 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 21 Apr 2020 16:09:06 +0100 Subject: [PATCH 23/43] inheritance diagrams --- GPy/models/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/GPy/models/__init__.py b/GPy/models/__init__.py index 9797f494..0badc799 100644 --- a/GPy/models/__init__.py +++ b/GPy/models/__init__.py @@ -5,8 +5,20 @@ Introduction ^^^^^^^^^^^^ -This package principally contains classes ultimately inherited from :py:class:`GPy.core.gp.GP` intended as models for end user consuption - much of :py:class:`GPy.core.gp.GP` is not intended to be called directly. Some of these fall into conceptually related groups of models (e.g. :py:class:`GPy.core.sparse_gp`, :py:class:`GPy.core.sparse_gp_mpi`). +This package principally contains classes ultimately inherited from :py:class:`GPy.core.gp.GP` intended as models for end user consuption - much of :py:class:`GPy.core.gp.GP` is not intended to be called directly. Several models directly inherit :py:class:`GPy.core.gp.GP`: +.. inheritance-diagram:: GPy.models.gp_classification GPy.models.gp_coregionalized_regression GPy.models.gp_heteroscedastic_regression GPy.models.gp_offset_regression GPy.models.gp_regression GPy.models.gp_var_gauss GPy.models.gplvm GPy.models.input_warped_gp GPy.models.multioutput_gp + :top-classes: GPy.core.gp.GP + +Some models fall into conceptually related groups of models (e.g. :py:class:`GPy.core.sparse_gp`, :py:class:`GPy.core.sparse_gp_mpi`): + +.. inheritance-diagram:: GPy.models.bayesian_gplvm GPy.models.bayesian_gplvm_minibatch GPy.models.gp_multiout_regression GPy.models.gp_multiout_regression_md GPy.models.ibp_lfm.IBPLFM GPy.models.sparse_gp_coregionalized_regression GPy.models.sparse_gp_minibatch GPy.models.sparse_gp_regression GPy.models.sparse_gp_regression_md GPy.models.sparse_gplvm + :top-classes: GPy.core.gp.GP + +In some cases one end-user model inherits another e.g. + +.. inheritance-diagram:: GPy.models.bayesian_gplvm_minibatch + :top-classes: GPy.models.sparse_gp_minibatch.SparseGPMiniBatch """ From 2b22d4027aa8faf8ffc288da7c9304951a838b36 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Wed, 22 Apr 2020 10:05:59 +0100 Subject: [PATCH 24/43] more on models --- GPy/models/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPy/models/__init__.py b/GPy/models/__init__.py index 0badc799..6669b357 100644 --- a/GPy/models/__init__.py +++ b/GPy/models/__init__.py @@ -5,7 +5,9 @@ Introduction ^^^^^^^^^^^^ -This package principally contains classes ultimately inherited from :py:class:`GPy.core.gp.GP` intended as models for end user consuption - much of :py:class:`GPy.core.gp.GP` is not intended to be called directly. Several models directly inherit :py:class:`GPy.core.gp.GP`: +This package principally contains classes ultimately inherited from :py:class:`GPy.core.gp.GP` intended as models for end user consuption - much of :py:class:`GPy.core.gp.GP` is not intended to be called directly. The general form of a "model" is a function that takes some data, a kernel (see :py:class:`GPy.kern`) and other parameters, returning an object representation. + +Several models directly inherit :py:class:`GPy.core.gp.GP`: .. inheritance-diagram:: GPy.models.gp_classification GPy.models.gp_coregionalized_regression GPy.models.gp_heteroscedastic_regression GPy.models.gp_offset_regression GPy.models.gp_regression GPy.models.gp_var_gauss GPy.models.gplvm GPy.models.input_warped_gp GPy.models.multioutput_gp :top-classes: GPy.core.gp.GP From 24549e8c7d2d55c9bbaa6fd61b0d6b3a892bde3b Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Wed, 22 Apr 2020 11:14:03 +0100 Subject: [PATCH 25/43] kernel docs to kern.src --- GPy/kern/__init__.py | 6 ------ GPy/kern/src/__init__.py | 9 +++++++++ doc/source/index.rst | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index 0b769e0a..5ed58e83 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -1,10 +1,4 @@ -""" -Kernel module the kernels to sit in. -.. automodule:: .src - :members: - :private-members: -""" from .src.kern import Kern from .src.add import Add from .src.prod import Prod diff --git a/GPy/kern/src/__init__.py b/GPy/kern/src/__init__.py index 69522e32..4056bf42 100644 --- a/GPy/kern/src/__init__.py +++ b/GPy/kern/src/__init__.py @@ -1 +1,10 @@ +""" + +In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. + +.. inheritance-diagram:: GPy.kern.src.kern.Kern + :top-classes: GPy.core.parameterization.parameterized.Parameterized + +""" + from . import psi_comp diff --git a/doc/source/index.rst b/doc/source/index.rst index 61a605d9..c0a710e7 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -47,7 +47,7 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Wed, 22 Apr 2020 11:24:36 +0100 Subject: [PATCH 26/43] moved doc back from kern.src to kern --- GPy/kern/__init__.py | 11 +++++++++++ GPy/kern/src/__init__.py | 8 -------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index 5ed58e83..a5fd01ad 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -1,4 +1,15 @@ +""" + +In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. + +:py:class:`GPy.kern.src.kern.Kern` is a generic kernel object inherited by more specific, end-user kernels used in models. It provides methods that specific kernels should generally have such as :py:class:`GPy.kern.src.kern.Kern.K` to compute the value of the kernel, :py:class:`GPy.kern.src.kern.Kern.add` to combine kernels and numerous functions providing information on kernel gradients. + +.. inheritance-diagram:: GPy.kern.src.kern.Kern + :top-classes: GPy.core.parameterization.parameterized.Parameterized + +""" + from .src.kern import Kern from .src.add import Add from .src.prod import Prod diff --git a/GPy/kern/src/__init__.py b/GPy/kern/src/__init__.py index 4056bf42..2d81d9b6 100644 --- a/GPy/kern/src/__init__.py +++ b/GPy/kern/src/__init__.py @@ -1,10 +1,2 @@ -""" - -In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. - -.. inheritance-diagram:: GPy.kern.src.kern.Kern - :top-classes: GPy.core.parameterization.parameterized.Parameterized - -""" from . import psi_comp From 4a64e3260ef1894a5ef8ff0dd59e433222f6f5c3 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Wed, 22 Apr 2020 11:26:51 +0100 Subject: [PATCH 27/43] kern not kern.src in index --- doc/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index c0a710e7..61a605d9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -47,7 +47,7 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Thu, 23 Apr 2020 09:04:17 +0100 Subject: [PATCH 28/43] better kernel description --- GPy/kern/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index a5fd01ad..33301817 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -1,15 +1,26 @@ """ +Introduction +^^^^^^^^^^^^ -In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. +In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. *Note: this may be too simple a definition for the broad range of kernels available in :py:class:`GPy`.* :py:class:`GPy.kern.src.kern.Kern` is a generic kernel object inherited by more specific, end-user kernels used in models. It provides methods that specific kernels should generally have such as :py:class:`GPy.kern.src.kern.Kern.K` to compute the value of the kernel, :py:class:`GPy.kern.src.kern.Kern.add` to combine kernels and numerous functions providing information on kernel gradients. -.. inheritance-diagram:: GPy.kern.src.kern.Kern +There are several inherited types of kernel that provide a basis for specific end user kernels: + +.. inheritance-diagram:: GPy.kern.src.kern.Kern GPy.kern.src.static GPy.kern.src.stationary GPy.kern.src.kern.CombinationKernel GPy.kern.src.brownian GPy.kern.src.linear GPy.kern.src.standard_periodic + :top-classes: GPy.core.parameterization.parameterized.Parameterized + +e.g. the archetype :py:class:`GPy.kern.RBF` does not inherit directly from :py:class:`GPy.kern.src.kern.Kern`, but from :py:class:`GPy.kern.src.stationary`. + +.. inheritance-diagram:: GPy.kern.src.kern.Kern GPy.kern.RBF :top-classes: GPy.core.parameterization.parameterized.Parameterized """ + + from .src.kern import Kern from .src.add import Add from .src.prod import Prod From 4e411c4b26f738dcbd098c5b8c697a9e5e607854 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Fri, 24 Apr 2020 10:19:36 +0100 Subject: [PATCH 29/43] likelihoods --- GPy/likelihoods/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/GPy/likelihoods/__init__.py b/GPy/likelihoods/__init__.py index 7ec8092b..606a5167 100644 --- a/GPy/likelihoods/__init__.py +++ b/GPy/likelihoods/__init__.py @@ -1,3 +1,16 @@ +""" +Introduction +^^^^^^^^^^^^ + +'Likelihood' in this context is a measure of how well a model *f* predicts a dataset *y*. The importance of likelihoods in Gaussian Processes is in determining the 'best' values of kernel and noise hyperparamters to relate known, observed and unobserved data. The purpose of optimizing a model (e.g. :py:class:`GPy.models.GPRegression`) is to determine the 'best' hyperparameters i.e. those that minimize negative log marginal likelihood. + +.. inheritance-diagram:: GPy.likelihoods.likelihood GPy.likelihoods.mixed_noise.MixedNoise + :top-classes: GPy.core.parameterization.parameterized.Parameterized + +Most likelihood classes inherit directly from :py:class:`GPy.likelihoods.likelihood`, although an intermediary class :py:class:`GPy.likelihoods.mixed_noise.MixedNoise` is used by :py:class:`GPy.likelihoods.multioutput_likelihood`. + +""" + from .bernoulli import Bernoulli from .exponential import Exponential from .gaussian import Gaussian, HeteroscedasticGaussian From 3e6cc2888dd693d441bbc27a4548b9d6cb5698fc Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Mon, 27 Apr 2020 09:58:12 +0100 Subject: [PATCH 30/43] placeholder --- GPy/inference/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GPy/inference/__init__.py b/GPy/inference/__init__.py index 4d94c619..283cb8dc 100644 --- a/GPy/inference/__init__.py +++ b/GPy/inference/__init__.py @@ -1,3 +1,11 @@ +""" +Introduction +^^^^^^^^^^^^ + + + +""" + from . import optimization from . import latent_function_inference from . import mcmc From b0c18a90a4d755a27e316bfe3858cf7ac8faa1ea Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 28 Apr 2020 09:28:36 +0100 Subject: [PATCH 31/43] add plotting to docs index --- GPy/plotting/__init__.py | 8 ++++++++ doc/source/index.rst | 1 + 2 files changed, 9 insertions(+) diff --git a/GPy/plotting/__init__.py b/GPy/plotting/__init__.py index 8c680caf..bbf83fa9 100644 --- a/GPy/plotting/__init__.py +++ b/GPy/plotting/__init__.py @@ -1,3 +1,11 @@ +""" +Introduction +^^^^^^^^^^^^ + + + +""" + # Copyright (c) 2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) current_lib = [None] diff --git a/doc/source/index.rst b/doc/source/index.rst index 61a605d9..dea42f81 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -52,6 +52,7 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Tue, 28 Apr 2020 11:04:28 +0100 Subject: [PATCH 32/43] summarise plotting --- GPy/plotting/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/plotting/__init__.py b/GPy/plotting/__init__.py index bbf83fa9..ffed794d 100644 --- a/GPy/plotting/__init__.py +++ b/GPy/plotting/__init__.py @@ -2,7 +2,7 @@ Introduction ^^^^^^^^^^^^ - +:py:class:`GPy.plotting` extends models based on :py:class:`GPy.core.gp.GP` by adding methods to plot useful charts. 'matplotlib', 'plotly' (online) and 'plotly' (offline) are supported. The methods in :py:class:`GPy.plotting` (and child classes :py:class:`GPy.plotting.gpy_plot` and :py:class:`GPy.plotting.matplot_dep`) are not intended to be called directly, but rather are 'injected' into other classes (notably :py:class:`GPy.core.gp.GP`). Documentation describing plots is best found associated with the model being plotted e.g. :py:class:`GPy.core.gp.GP.plot_confidence`. """ From 86a87f3397b0cf980bff38d35543256c62802440 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 28 Apr 2020 11:05:56 +0100 Subject: [PATCH 33/43] clarification --- GPy/plotting/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/plotting/__init__.py b/GPy/plotting/__init__.py index ffed794d..e1c50fe9 100644 --- a/GPy/plotting/__init__.py +++ b/GPy/plotting/__init__.py @@ -2,7 +2,7 @@ Introduction ^^^^^^^^^^^^ -:py:class:`GPy.plotting` extends models based on :py:class:`GPy.core.gp.GP` by adding methods to plot useful charts. 'matplotlib', 'plotly' (online) and 'plotly' (offline) are supported. The methods in :py:class:`GPy.plotting` (and child classes :py:class:`GPy.plotting.gpy_plot` and :py:class:`GPy.plotting.matplot_dep`) are not intended to be called directly, but rather are 'injected' into other classes (notably :py:class:`GPy.core.gp.GP`). Documentation describing plots is best found associated with the model being plotted e.g. :py:class:`GPy.core.gp.GP.plot_confidence`. +:py:class:`GPy.plotting` effectively extends models based on :py:class:`GPy.core.gp.GP` (and other classes) by adding methods to plot useful charts. 'matplotlib', 'plotly' (online) and 'plotly' (offline) are supported. The methods in :py:class:`GPy.plotting` (and child classes :py:class:`GPy.plotting.gpy_plot` and :py:class:`GPy.plotting.matplot_dep`) are not intended to be called directly, but rather are 'injected' into other classes (notably :py:class:`GPy.core.gp.GP`). Documentation describing plots is best found associated with the model being plotted e.g. :py:class:`GPy.core.gp.GP.plot_confidence`. """ From cf11962f05508815e39bafc08ec80e0ff82a4e67 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 28 Apr 2020 11:21:54 +0100 Subject: [PATCH 34/43] neater contents --- doc/source/index.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index dea42f81..c3f3c54e 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -53,8 +53,6 @@ Several tutorials have been developed in the form of `Jupyter Notebooks Date: Tue, 28 Apr 2020 14:01:26 +0100 Subject: [PATCH 35/43] architecture diagram --- doc/source/architecture.rst | 4 ---- doc/source/index.rst | 39 +++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) delete mode 100644 doc/source/architecture.rst diff --git a/doc/source/architecture.rst b/doc/source/architecture.rst deleted file mode 100644 index b63166aa..00000000 --- a/doc/source/architecture.rst +++ /dev/null @@ -1,4 +0,0 @@ -GPy Project Architecture -======================== - - diff --git a/doc/source/index.rst b/doc/source/index.rst index c3f3c54e..707afd88 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -25,11 +25,42 @@ Tutorials Several tutorials have been developed in the form of `Jupyter Notebooks `_. -.. toctree:: - :maxdepth: 1 - :caption: Architecture +Architecture +------------ - architecture +GPy is a big, powerful package, with many features. The concept of how to use GPy in general terms is roughly as follows. A model (:py:class:`GPy.models`) is created - this is at the heart of GPy from a user perspective. A kernel (:py:class:`GPy.kern`), data and, usually, a representation of noise are assigned to the model. Specific models require, or can make use of, additional information. The kernel and noise are controlled by hyperparameters - calling the optimize (:py:class:`GPy.core.gp.GP.optimize`) method against the model invokes an iterative process which seeks optimal hyperparameter values. The model object can be used to make plots and predictions (:py:class:`GPy.core.gp.GP.predict`). + +.. graphviz:: + + digraph GPy_Arch { + + rankdir=LR + node[shape="rectangle" style="rounded,filled" fontname="Arial"] + edge [color="#006699" len=2.5] + + Data->Model + Hyperparameters->Kernel + Hyperparameters->Noise + Kernel->Model + Noise->Model + + Model->Optimize + Optimize->Hyperparameters + + Model->Predict + Model->Plot + + Optimize [shape="ellipse"] + Predict [shape="ellipse"] + Plot [shape="ellipse"] + + subgraph cluster_0 { + Data + Kernel + Noise + } + + } .. toctree:: :maxdepth: 1 From dec5bf8cefcc21c1363082fb1d2eb75a32b78af3 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 5 May 2020 12:46:57 +0100 Subject: [PATCH 36/43] using pods --- GPy/examples/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/examples/__init__.py b/GPy/examples/__init__.py index 8c7a5b65..4c5929f1 100644 --- a/GPy/examples/__init__.py +++ b/GPy/examples/__init__.py @@ -4,7 +4,7 @@ Examples for GPy. The examples in this package usually depend on `pods `_ so make sure -you have that installed before running examples. +you have that installed before running examples. The easiest way to do this is to run `pip install pods`. `pods` enables access to 3rd party data required for most of the examples. """ from . import classification from . import regression From f9aeffdba34c164626ff276f33431bfccd3b5944 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 12 May 2020 13:36:49 +0100 Subject: [PATCH 37/43] build with dot --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 171c0369..c8773758 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,13 @@ The documentation can be compiled as follows: sphinx-apidoc -o source/ ../GPy/ make html +alternatively: + +```{shell} +cd doc +sphinx-build -b html -d build/doctrees -D graphviz_dot='' source build/html +``` + The HTML files are then stored in doc/build/html ### Commit new patch to devel From 159ca2eba691e06ccde274b33ea19f736ac1965d Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 12 May 2020 13:44:03 +0100 Subject: [PATCH 38/43] more on examples --- GPy/examples/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GPy/examples/__init__.py b/GPy/examples/__init__.py index 4c5929f1..d0636ea8 100644 --- a/GPy/examples/__init__.py +++ b/GPy/examples/__init__.py @@ -1,10 +1,16 @@ # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) """ -Examples for GPy. +Introduction +^^^^^^^^^^^^ The examples in this package usually depend on `pods `_ so make sure you have that installed before running examples. The easiest way to do this is to run `pip install pods`. `pods` enables access to 3rd party data required for most of the examples. + +The examples are executable and self-contained workflows in that they have their own source data, create their own models, kernels and other objects as needed, execute optimisation as required, and display output. + +Viewing the source code of each model will clarify the steps taken in its execution, and may provide inspiration for developing of user-specific applications of `GPy`. + """ from . import classification from . import regression From 3684e64ac2de501a7e211e87f15bd7047f32fc1c Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Tue, 12 May 2020 13:57:15 +0100 Subject: [PATCH 39/43] introduction for utils package --- GPy/util/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GPy/util/__init__.py b/GPy/util/__init__.py index 55b88986..de6df56a 100644 --- a/GPy/util/__init__.py +++ b/GPy/util/__init__.py @@ -1,6 +1,12 @@ # Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) +""" +Introduction +^^^^^^^^^^^^ +A variety of utility functions including matrix operations and quick access to test datasets. + +""" from . import linalg from . import misc From 9fee83fdb042c561618b962776d653614f473e42 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Wed, 20 May 2020 11:16:19 +0100 Subject: [PATCH 40/43] compromise formatting for sphinx --- GPy/kern/src/coregionalize.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPy/kern/src/coregionalize.py b/GPy/kern/src/coregionalize.py index 0c471cb3..d5111c3b 100644 --- a/GPy/kern/src/coregionalize.py +++ b/GPy/kern/src/coregionalize.py @@ -20,12 +20,13 @@ class Coregionalize(Kern): Covariance function for intrinsic/linear coregionalization models This covariance has the form: + .. math:: - \mathbf{B} = \mathbf{W}\mathbf{W}^\top + \text{diag}(kappa) + \mathbf{B} = \mathbf{W}\mathbf{W}^\intercal + \mathrm{diag}(kappa) An intrinsic/linear coregionalization covariance function of the form: - .. math:: + .. math:: k_2(x, y)=\mathbf{B} k(x, y) it is obtained as the tensor product between a covariance function From e0304056f95de8922fce72b2a7ddfcd9bb4916ce Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Wed, 3 Jun 2020 15:52:16 +0100 Subject: [PATCH 41/43] correct likelihod definition --- GPy/likelihoods/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/likelihoods/__init__.py b/GPy/likelihoods/__init__.py index 606a5167..975abc88 100644 --- a/GPy/likelihoods/__init__.py +++ b/GPy/likelihoods/__init__.py @@ -2,7 +2,7 @@ Introduction ^^^^^^^^^^^^ -'Likelihood' in this context is a measure of how well a model *f* predicts a dataset *y*. The importance of likelihoods in Gaussian Processes is in determining the 'best' values of kernel and noise hyperparamters to relate known, observed and unobserved data. The purpose of optimizing a model (e.g. :py:class:`GPy.models.GPRegression`) is to determine the 'best' hyperparameters i.e. those that minimize negative log marginal likelihood. +The likelihood is :math:`p(y|f,X)` which is how well we will predict target values given inputs :math:`X` and our latent function :math:`f` (:math:`y` without noise). Marginal likelihood :math:`p(y|X)`, is the same as likelihood except we marginalize out the model :math:`f`. The importance of likelihoods in Gaussian Processes is in determining the 'best' values of kernel and noise hyperparamters to relate known, observed and unobserved data. The purpose of optimizing a model (e.g. :py:class:`GPy.models.GPRegression`) is to determine the 'best' hyperparameters i.e. those that minimize negative log marginal likelihood. .. inheritance-diagram:: GPy.likelihoods.likelihood GPy.likelihoods.mixed_noise.MixedNoise :top-classes: GPy.core.parameterization.parameterized.Parameterized From ef044197fbcac01e74d14281da1475a14d4702f8 Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Thu, 4 Jun 2020 09:51:30 +0100 Subject: [PATCH 42/43] parameterization of priors --- GPy/core/parameterization/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/GPy/core/parameterization/__init__.py b/GPy/core/parameterization/__init__.py index fb064c9c..28ac755f 100644 --- a/GPy/core/parameterization/__init__.py +++ b/GPy/core/parameterization/__init__.py @@ -1,3 +1,14 @@ +""" +Introduction +^^^^^^^^^^^^ + +Extends the functionality of the `paramz` package (dependency) to support paramterization of priors (:py:class:`GPy.core.parameterization.priors`). + +.. inheritance-diagram:: GPy.core.parameterization.priors + :top-classes: paramz.core.parameter_core.Parameterizable +""" + + # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) From 923343dcc268f35029bf7e1bd0296d7897e7c84a Mon Sep 17 00:00:00 2001 From: bobturneruk Date: Thu, 18 Jun 2020 09:36:24 +0100 Subject: [PATCH 43/43] latent function inference intro and format --- .../latent_function_inference/__init__.py | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/GPy/inference/latent_function_inference/__init__.py b/GPy/inference/latent_function_inference/__init__.py index be4fbde6..5af09442 100644 --- a/GPy/inference/latent_function_inference/__init__.py +++ b/GPy/inference/latent_function_inference/__init__.py @@ -1,23 +1,30 @@ # Copyright (c) 2012-2014, Max Zwiessele, James Hensman # Licensed under the BSD 3-clause license (see LICENSE.txt) -__doc__ = """ +""" +Introduction +^^^^^^^^^^^^ + +Certain :py:class:`GPy.models` can be instanciated with an `inference_method`. This submodule contains objects that can be assigned to `inference_method`. + Inference over Gaussian process latent functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -In all our GP models, the consistency propery means that we have a Gaussian -prior over a finite set of points f. This prior is +In all our GP models, the consistency property means that we have a Gaussian +prior over a finite set of points f. This prior is: - math:: N(f | 0, K) +.. math:: + N(f | 0, K) -where K is the kernel matrix. +where :math:`K` is the kernel matrix. -We also have a likelihood (see GPy.likelihoods) which defines how the data are -related to the latent function: p(y | f). If the likelihood is also a Gaussian, -the inference over f is tractable (see exact_gaussian_inference.py). +We also have a likelihood (see :py:class:`GPy.likelihoods`) which defines how the data are +related to the latent function: :math:`p(y | f)`. If the likelihood is also a Gaussian, +the inference over :math:`f` is tractable (see :py:class:`GPy.inference.latent_function_inference.exact_gaussian_inference`). If the likelihood object is something other than Gaussian, then exact inference -is not tractable. We then resort to a Laplace approximation (laplace.py) or -expectation propagation (ep.py). +is not tractable. We then resort to a Laplace approximation (:py:class:`GPy.inference.latent_function_inference.laplace`) or +expectation propagation (:py:class:`GPy.inference.latent_function_inference.expectation_propagation`). The inference methods return a :class:`~GPy.inference.latent_function_inference.posterior.Posterior`