Skip to content

Commit

Permalink
GPflow 2.0 notebook update: GPs for big data (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
st-- authored and awav committed Oct 1, 2019
1 parent 705380d commit 6e57626
Show file tree
Hide file tree
Showing 7 changed files with 711 additions and 135 deletions.
206 changes: 110 additions & 96 deletions doc/source/notebooks/advanced/gps_for_big_data.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks2/ci_utils.py → gpflow/ci_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017 Artem Artemev @awav
# Copyright 2017-2019 GPflow
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
23 changes: 13 additions & 10 deletions gpflow/inducing_variables/inducing_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,19 @@

class InducingVariables(tf.Module):
"""
Abstract base class for inducing inducing.
Abstract base class for inducing variables.
"""

@abc.abstractmethod
def __len__(self) -> int:
"""
Returns the number of inducing, relevant for example to determine the
size of the variational distribution.
Returns the number of inducing variables, relevant for example
to determine the size of the variational distribution.
"""
pass


class InducingPoints(InducingVariables):
"""
Real-space inducing points
"""

class InducingPointsBase(InducingVariables):
def __init__(self, Z):
"""
:param Z: the initial positions of the inducing points, size [M, D]
Expand All @@ -50,9 +46,16 @@ def __len__(self):
return self.Z.shape[0]


class Multiscale(InducingPoints):
class InducingPoints(InducingPointsBase):
"""
Real-space inducing points
"""


class Multiscale(InducingPointsBase):
"""
Multi-scale inducing inducing
Multi-scale inducing variables
Originally proposed in
::
Expand Down
21 changes: 9 additions & 12 deletions gpflow/models/svgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,24 @@ class SVGP(GPModel):
def __init__(self,
kernel,
likelihood,
inducing_variable=None,
inducing_variable,
mean_function=None,
num_latent=1,
q_diag=False,
*,
num_latent: int=1,
q_diag: bool=False,
q_mu=None,
q_sqrt=None,
whiten=True,
whiten: bool=True,
num_data=None):
"""
- X is a data matrix, size [N, D]
- Y is a data matrix, size [N, P]
- kernel, likelihood, mean_function are appropriate GPflow objects
- Z is a matrix of pseudo inputs, size [M, D]
- num_latent is the number of latent process to use, default to
Y.shape[1]
- kernel, likelihood, inducing_variables, mean_function are appropriate
GPflow objects
- num_latent is the number of latent processes to use, defaults to 1
- q_diag is a boolean. If True, the covariance is approximated by a
diagonal matrix.
- whiten is a boolean. If True, we use the whitened representation of
the inducing points.
- minibatch_size, if not None, turns on mini-batching with that size.
- num_data is the total number of observations, default to X.shape[0]
- num_data is the total number of observations, defaults to X.shape[0]
(relevant when feeding in external minibatches)
"""
# init the super class, accept args
Expand Down
576 changes: 576 additions & 0 deletions notebooks2/advanced/gps_for_big_data.ipynb

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions notebooks2/advanced/multioutput.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,7 @@
"import gpflow as gpf\n",
"\n",
"from gpflow.utilities import print_summary\n",
"\n",
"import sys\n",
"from pathlib import Path\n",
"module_path = str(Path(\"..\").absolute().resolve())\n",
"if module_path not in sys.path:\n",
" sys.path.append(module_path)\n",
"\n",
"from ci_utils import ci_niter\n",
"from gpflow.ci_utils import ci_niter\n",
"\n",
"gpf.config.set_default_float(np.float64)\n",
"gpf.config.set_summary_fmt(\"notebook\")\n",
Expand Down
9 changes: 1 addition & 8 deletions notebooks2/basics/gplvm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@
"import gpflow\n",
"from gpflow.utilities import ops, print_summary\n",
"from gpflow.config import set_default_float, default_float, set_summary_fmt\n",
"\n",
"import sys\n",
"from pathlib import Path\n",
"module_path = str(Path(\"..\").absolute().resolve())\n",
"if module_path not in sys.path:\n",
" sys.path.append(module_path)\n",
"\n",
"from ci_utils import ci_niter\n",
"from gpflow.ci_utils import ci_niter\n",
"\n",
"set_default_float(np.float64)\n",
"set_summary_fmt(\"notebook\")\n",
Expand Down

0 comments on commit 6e57626

Please sign in to comment.