Skip to content

Commit e9e9026

Browse files
authored
Merge branch 'master' into fix
2 parents 6f86ff4 + d40545d commit e9e9026

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+300
-271
lines changed

docs/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def find_version(*file_paths):
8080
extensions = [
8181
"sphinx.ext.coverage",
8282
"sphinx.ext.mathjax",
83+
'sphinx.ext.napoleon',
8384
"sphinx.ext.viewcode",
8485
"sphinx.ext.githubpages",
8586
"sphinx.ext.autodoc",

gpytorch/distributions/multitask_multivariate_normal.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def from_batch_mvn(cls, batch_mvn, task_dim=-1):
119119
def from_independent_mvns(cls, mvns):
120120
"""
121121
Convert an iterable of MVNs into a :obj:`~gpytorch.distributions.MultitaskMultivariateNormal`.
122-
The resulting distribution will have :attr:`len(mvns)` tasks, and the tasks will be independent.
122+
The resulting distribution will have ``len(mvns)`` tasks, and the tasks will be independent.
123123
124124
:param ~gpytorch.distributions.MultitaskNormal mvn: The base MVN distributions.
125125
:returns: the independent multitask distribution
@@ -247,7 +247,7 @@ def to_data_independent_dist(self):
247247
"""
248248
Convert a multitask MVN into a batched (non-multitask) MVNs
249249
The result retains the intertask covariances, but gets rid of the inter-data covariances.
250-
The resulting distribution will have :attr:`len(mvns)` tasks, and the tasks will be independent.
250+
The resulting distribution will have ``len(mvns)`` tasks, and the tasks will be independent.
251251
252252
:returns: the bached data-independent MVN
253253
:rtype: gpytorch.distributions.MultivariateNormal

gpytorch/functions/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def add_diag(input, diag):
1313
Adds a diagonal matrix s*I to the input matrix input.
1414
1515
Args:
16-
:attr:`input` (Tensor (nxn) or (bxnxn)):
16+
input (Tensor (nxn) or (bxnxn)):
1717
Tensor or LazyTensor wrapping matrix to add diagonal component to.
18-
:attr:`diag` (scalar or Tensor (n) or Tensor (bxn) or Tensor (bx1)):
18+
diag (scalar or Tensor (n) or Tensor (bxn) or Tensor (bx1)):
1919
Diagonal component to add to tensor
2020
2121
Returns:
@@ -89,7 +89,7 @@ def matmul(mat, rhs):
8989

9090
def inv_matmul(mat, right_tensor, left_tensor=None):
9191
r"""
92-
Computes a linear solve (w.r.t :attr:`mat` = :math:`A`) with several right hand sides :math:`R`.
92+
Computes a linear solve (w.r.t mat = :math:`A`) with several right hand sides :math:`R`.
9393
I.e. computes
9494
9595
... math::
@@ -98,17 +98,17 @@ def inv_matmul(mat, right_tensor, left_tensor=None):
9898
A^{-1} R,
9999
\end{equation}
100100
101-
where :math:`R` is :attr:`right_tensor` and :math:`A` is :attr:`mat`.
101+
where :math:`R` is right_tensor and :math:`A` is mat.
102102
103-
If :attr:`left_tensor` is supplied, computes
103+
If left_tensor is supplied, computes
104104
105105
... math::
106106
107107
\begin{equation}
108108
L A^{-1} R,
109109
\end{equation}
110110
111-
where :math:`L` is :attr:`left_tensor`. Supplying this can reduce the number of
111+
where :math:`L` is left_tensor. Supplying this can reduce the number of
112112
CG calls required.
113113
114114
Args:
@@ -181,7 +181,7 @@ def pivoted_cholesky(mat, rank, error_tol=None, return_pivots=None):
181181
:type mat: ~gpytorch.lazy.LazyTensor or ~torch.Tensor
182182
:param int rank: The size of the partial pivoted Cholesky factor.
183183
:param error_tol: Defines an optional stopping criterion.
184-
If the residual of the factorization is less than :attr:`error_tol`, then the
184+
If the residual of the factorization is less than error_tol, then the
185185
factorization will exit early. This will result in a :math:`\leq \text{ rank}` factor.
186186
:type error_tol: float, optional
187187
:param bool return_pivots: (default: False) Whether or not to return the pivots alongside

gpytorch/functions/_diagonalization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def forward(ctx, representation_tree, device, dtype, matrix_shape, max_iter, bat
1414
:param list matrix_args: The arguments representing the symmetric matrix A (or batch of PSD matrices A)
1515
1616
:rtype: (torch.Tensor, torch.Tensor)
17-
:return: :attr:`Q`, :attr: `S` such that :math:`Q S Q^T \approx A`
17+
:return: Q, S such that :math:`Q S Q^T \approx A`
1818
"""
1919

2020
ctx.representation_tree = representation_tree

gpytorch/functions/_root_decomposition.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def forward(
2626
:param list matrix_args: The arguments representing the symmetric matrix A (or batch of PSD matrices A)
2727
2828
:rtype: (torch.Tensor, torch.Tensor)
29-
:return: :attr:`R`, such that :math:`R R^T \approx A`, and :attr:`R_inv`, such that
29+
:return: R, such that :math:`R R^T \approx A`, and R_inv, such that
3030
:math:`R_{inv} R_{inv}^T \approx A^{-1}` (will only be populated if self.inverse = True)
3131
"""
3232
from ..lazy import lazify

gpytorch/kernels/additive_structure_kernel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class AdditiveStructureKernel(Kernel):
2626
of the additive terms in batch, making it very fast.
2727
2828
Args:
29-
:attr:`base_kernel` (Kernel):
29+
base_kernel (Kernel):
3030
The kernel to approximate with KISS-GP
31-
:attr:`num_dims` (int):
31+
num_dims (int):
3232
The dimension of the input data.
33-
:attr:`active_dims` (tuple of ints, optional):
33+
active_dims (tuple of ints, optional):
3434
Passed down to the `base_kernel`.
3535
"""
3636

gpytorch/kernels/cosine_kernel.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ class CosineKernel(Kernel):
2525
where :math:`p` is the period length parameter.
2626
2727
Args:
28-
:attr:`batch_shape` (torch.Size, optional):
28+
batch_shape (torch.Size, optional):
2929
Set this if you want a separate lengthscale for each
30-
batch of input data. It should be `b` if :attr:`x1` is a `b x n x d` tensor. Default: `torch.Size([])`
31-
:attr:`active_dims` (tuple of ints, optional):
30+
batch of input data. It should be `b` if x1 is a `b x n x d` tensor. Default: `torch.Size([])`
31+
active_dims (tuple of ints, optional):
3232
Set this if you want to compute the covariance of only a few input dimensions. The ints
3333
corresponds to the indices of the dimensions. Default: `None`.
34-
:attr:`period_length_prior` (Prior, optional):
34+
period_length_prior (Prior, optional):
3535
Set this if you want to apply a prior to the period length parameter. Default: `None`
36-
:attr:`period_length_constraint` (Constraint, optional):
36+
period_length_constraint (Constraint, optional):
3737
Set this if you want to apply a constraint to the period length parameter. Default: `Positive`.
38-
:attr:`eps` (float):
38+
eps (float):
3939
The minimum value that the lengthscale/period length can take
4040
(prevents divide by zero errors). Default: `1e-6`.
4141
4242
Attributes:
43-
:attr:`period_length` (Tensor):
43+
period_length (Tensor):
4444
The period length parameter. Size = `*batch_shape x 1 x 1`.
4545
4646
Example:

gpytorch/kernels/cylindrical_kernel.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ class CylindricalKernel(Kernel):
2121
The data must lie completely within the unit ball.
2222
2323
Args:
24-
:attr:`num_angular_weights` (int):
24+
num_angular_weights (int):
2525
The number of components in the angular kernel
26-
:attr:`radial_base_kernel` (gpytorch.kernel):
26+
radial_base_kernel (gpytorch.kernel):
2727
The base kernel for computing the radial kernel
28-
:attr:`batch_size` (int, optional):
28+
batch_size (int, optional):
2929
Set this if the data is batch of input data.
30-
It should be `b` if :attr:`x1` is a `b x n x d` tensor. Default: `1`
31-
:attr:`eps` (float):
30+
It should be `b` if x1 is a `b x n x d` tensor. Default: `1`
31+
eps (float):
3232
Small floating point number used to improve numerical stability
3333
in kernel computations. Default: `1e-6`
34-
:attr:`param_transform` (function, optional):
34+
param_transform (function, optional):
3535
Set this if you want to use something other than softplus to ensure positiveness of parameters.
36-
:attr:`inv_param_transform` (function, optional):
36+
inv_param_transform (function, optional):
3737
Set this to allow setting parameters directly in transformed space and sampling from priors.
3838
Automatically inferred for common transformations such as torch.exp or torch.nn.functional.softplus.
3939
"""

gpytorch/kernels/distributional_input_kernel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DistributionalInputKernel(Kernel):
2020
where :math:`a` is the lengthscale.
2121
2222
Args:
23-
:attr:`distance_function` (function) distance function between distributional inputs.
23+
distance_function (function) distance function between distributional inputs.
2424
"""
2525
has_lengthscale = True
2626

gpytorch/kernels/gaussian_symmetrized_kl_kernel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ def _symmetrized_kl(dist1, dist2, eps=1e-8):
1010
the first half of the distribution tensors are the mean, and the second half
1111
are the log variances.
1212
Args:
13-
:attr:`dist1` (torch.Tensor) has shapes batch x n x dimensions. The first half
13+
dist1 (torch.Tensor) has shapes batch x n x dimensions. The first half
1414
of the last dimensions are the means, while the second half are the log-variances.
15-
:attr:`dist2` (torch.Tensor) has shapes batch x n x dimensions. The first half
15+
dist2 (torch.Tensor) has shapes batch x n x dimensions. The first half
1616
of the last dimensions are the means, while the second half are the log-variances.
17-
:attr:`eps` (float) jitter term for the noise variance
17+
eps (float) jitter term for the noise variance
1818
"""
1919

2020
num_dims = int(dist1.shape[-1] / 2)

gpytorch/kernels/grid_interpolation_kernel.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class GridInterpolationKernel(GridKernel):
3737
* :math:`\mathbf{w_{x_1}}` and :math:`\mathbf{w_{x_2}}` are sparse vectors based on
3838
:math:`\mathbf{x_1}` and :math:`\mathbf{x_2}` that apply cubic interpolation.
3939
40-
The user should supply the size of the grid (using the :attr:`grid_size` attribute).
40+
The user should supply the size of the grid (using the grid_size attribute).
4141
To choose a reasonable grid value, we highly recommend using the
4242
:func:`gpytorch.utils.grid.choose_grid_size` helper function.
4343
The bounds of the grid will automatically be determined by data.
4444
45-
(Alternatively, you can hard-code bounds using the :attr:`grid_bounds`, which
45+
(Alternatively, you can hard-code bounds using the grid_bounds, which
4646
will speed up this kernel's computations.)
4747
4848
.. note::
@@ -51,18 +51,18 @@ class GridInterpolationKernel(GridKernel):
5151
Periodic, Spectral Mixture, etc.)
5252
5353
Args:
54-
- :attr:`base_kernel` (Kernel):
54+
base_kernel (Kernel):
5555
The kernel to approximate with KISS-GP
56-
- :attr:`grid_size` (Union[int, List[int]]):
56+
grid_size (Union[int, List[int]]):
5757
The size of the grid in each dimension.
5858
If a single int is provided, then every dimension will have the same grid size.
59-
- :attr:`num_dims` (int):
59+
num_dims (int):
6060
The dimension of the input data. Required if `grid_bounds=None`
61-
- :attr:`grid_bounds` (tuple(float, float), optional):
61+
grid_bounds (tuple(float, float), optional):
6262
The bounds of the grid, if known (high performance mode).
6363
The length of the tuple must match the number of dimensions.
6464
The entries represent the min/max values for each dimension.
65-
- :attr:`active_dims` (tuple of ints, optional):
65+
active_dims (tuple of ints, optional):
6666
Passed down to the `base_kernel`.
6767
6868
.. _Kernel Interpolation for Scalable Structured Gaussian Processes:

gpytorch/kernels/grid_kernel.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class GridKernel(Kernel):
2525
Periodic, Spectral Mixture, etc.)
2626
2727
Args:
28-
:attr:`base_kernel` (Kernel):
28+
base_kernel (Kernel):
2929
The kernel to speed up with grid methods.
30-
:attr:`grid` (Tensor):
30+
grid (Tensor):
3131
A g x d tensor where column i consists of the projections of the
3232
grid in dimension i.
33-
:attr:`active_dims` (tuple of ints, optional):
33+
active_dims (tuple of ints, optional):
3434
Passed down to the `base_kernel`.
35-
:attr:`interpolation_mode` (bool):
35+
interpolation_mode (bool):
3636
Used for GridInterpolationKernel where we want the covariance
3737
between points in the projections of the grid of each dimension.
3838
We do this by treating `grid` as d batches of g x 1 tensors by

gpytorch/kernels/index_kernel.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ class IndexKernel(Kernel):
2525
These parameters are learned.
2626
2727
Args:
28-
:attr:`num_tasks` (int):
28+
num_tasks (int):
2929
Total number of indices.
30-
:attr:`batch_shape` (torch.Size, optional):
30+
batch_shape (torch.Size, optional):
3131
Set if the MultitaskKernel is operating on batches of data (and you want different
3232
parameters for each batch)
33-
:attr:`rank` (int):
33+
rank (int):
3434
Rank of :math:`B` matrix. Controls the degree of
3535
correlation between the outputs. With a rank of 1 the
3636
outputs are identical except for a scaling factor.
37-
:attr:`prior` (:obj:`gpytorch.priors.Prior`):
37+
prior (:obj:`gpytorch.priors.Prior`):
3838
Prior for :math:`B` matrix.
39-
:attr:`var_constraint` (Constraint, optional):
39+
var_constraint (Constraint, optional):
4040
Constraint for added diagonal component. Default: `Positive`.
4141
4242
Attributes:

gpytorch/kernels/kernel.py

+23-23
Original file line numberDiff line numberDiff line change
@@ -97,30 +97,30 @@ class Kernel(Module):
9797
9898
.. note::
9999
100-
The :attr:`lengthscale` parameter is parameterized on a log scale to constrain it to be positive.
101-
You can set a prior on this parameter using the :attr:`lengthscale_prior` argument.
100+
The lengthscale parameter is parameterized on a log scale to constrain it to be positive.
101+
You can set a prior on this parameter using the lengthscale_prior argument.
102102
103-
Base Args:
104-
:attr:`ard_num_dims` (int, optional):
103+
Args:
104+
ard_num_dims (int, optional):
105105
Set this if you want a separate lengthscale for each input
106-
dimension. It should be `d` if :attr:`x1` is a `n x d` matrix. Default: `None`
107-
:attr:`batch_shape` (torch.Size, optional):
106+
dimension. It should be `d` if x1 is a `n x d` matrix. Default: `None`
107+
batch_shape (torch.Size, optional):
108108
Set this if you want a separate lengthscale for each batch of input
109-
data. It should be `b1 x ... x bk` if :attr:`x1` is a `b1 x ... x bk x n x d` tensor.
110-
:attr:`active_dims` (tuple of ints, optional):
109+
data. It should be `b1 x ... x bk` if x1 is a `b1 x ... x bk x n x d` tensor.
110+
active_dims (tuple of ints, optional):
111111
Set this if you want to compute the covariance of only a few input dimensions. The ints
112112
corresponds to the indices of the dimensions. Default: `None`.
113-
:attr:`lengthscale_prior` (Prior, optional):
113+
lengthscale_prior (Prior, optional):
114114
Set this if you want to apply a prior to the lengthscale parameter. Default: `None`
115-
:attr:`lengthscale_constraint` (Constraint, optional):
115+
lengthscale_constraint (Constraint, optional):
116116
Set this if you want to apply a constraint to the lengthscale parameter. Default: `Positive`.
117-
:attr:`eps` (float):
117+
eps (float):
118118
The minimum value that the lengthscale can take (prevents divide by zero errors). Default: `1e-6`.
119119
120-
Base Attributes:
121-
:attr:`lengthscale` (Tensor):
120+
Attributes:
121+
lengthscale (Tensor):
122122
The lengthscale parameter. Size/shape of parameter depends on the
123-
:attr:`ard_num_dims` and :attr:`batch_shape` arguments.
123+
ard_num_dims and batch_shape arguments.
124124
125125
Example:
126126
>>> covar_module = gpytorch.kernels.LinearKernel()
@@ -188,13 +188,13 @@ def forward(self, x1, x2, diag=False, last_dim_is_batch=False, **params):
188188
This method should be imlemented by all Kernel subclasses.
189189
190190
Args:
191-
:attr:`x1` (Tensor `n x d` or `b x n x d`):
191+
x1 (Tensor `n x d` or `b x n x d`):
192192
First set of data
193-
:attr:`x2` (Tensor `m x d` or `b x m x d`):
193+
x2 (Tensor `m x d` or `b x m x d`):
194194
Second set of data
195-
:attr:`diag` (bool):
195+
diag (bool):
196196
Should the Kernel compute the whole kernel, or just the diag?
197-
:attr:`last_dim_is_batch` (tuple, optional):
197+
last_dim_is_batch (tuple, optional):
198198
If this is true, it treats the last dimension of the data as another batch dimension.
199199
(Useful for additive structure over the dimensions). Default: False
200200
@@ -284,15 +284,15 @@ def covar_dist(
284284
all pairs of points in x1 and x2.
285285
286286
Args:
287-
:attr:`x1` (Tensor `n x d` or `b1 x ... x bk x n x d`):
287+
x1 (Tensor `n x d` or `b1 x ... x bk x n x d`):
288288
First set of data.
289-
:attr:`x2` (Tensor `m x d` or `b1 x ... x bk x m x d`):
289+
x2 (Tensor `m x d` or `b1 x ... x bk x m x d`):
290290
Second set of data.
291-
:attr:`diag` (bool):
291+
diag (bool):
292292
Should we return the whole distance matrix, or just the diagonal? If True, we must have `x1 == x2`.
293-
:attr:`last_dim_is_batch` (tuple, optional):
293+
last_dim_is_batch (tuple, optional):
294294
Is the last dimension of the data a batch dimension or not?
295-
:attr:`square_dist` (bool):
295+
square_dist (bool):
296296
Should we square the distance matrix before returning?
297297
298298
Returns:

gpytorch/kernels/linear_kernel.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LinearKernel(Kernel):
2424
2525
where
2626
27-
* :math:`v` is a :attr:`variance` parameter.
27+
* :math:`v` is a variance parameter.
2828
2929
3030
.. note::
@@ -37,11 +37,11 @@ class LinearKernel(Kernel):
3737
:math:`O(nd)` time and space.
3838
3939
Args:
40-
:attr:`variance_prior` (:class:`gpytorch.priors.Prior`):
40+
variance_prior (:class:`gpytorch.priors.Prior`):
4141
Prior over the variance parameter (default `None`).
42-
:attr:`variance_constraint` (Constraint, optional):
42+
variance_constraint (Constraint, optional):
4343
Constraint to place on variance parameter. Default: `Positive`.
44-
:attr:`active_dims` (list):
44+
active_dims (list):
4545
List of data dimensions to operate on.
4646
`len(active_dims)` should equal `num_dimensions`.
4747
"""

0 commit comments

Comments
 (0)