Skip to content

Commit 4b3ab4a

Browse files
authored
Merge branch 'master' into patch-2
2 parents 99a2131 + 5b49fbb commit 4b3ab4a

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

docs/source/distributions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gpytorch.distributions
55
===================================
66

77
GPyTorch distribution objects are essentially the same as torch distribution objects.
8-
For the most part, GpyTorch relies on torch's distribution library.
8+
For the most part, GPyTorch relies on torch's distribution library.
99
However, we offer two custom distributions.
1010

1111
We implement a custom :obj:`~gpytorch.distributions.MultivariateNormal` that accepts

examples/01_Exact_GPs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Exact GPs (Regression)
22
========================
33

4-
Regression with a Gaussian noise model is the cannonical example of Gaussian processes.
4+
Regression with a Gaussian noise model is the canonical example of Gaussian processes.
55
These examples will work for small to medium sized datasets (~2,000 data points).
66
All examples here use exact GP inference.
77

gpytorch/kernels/kernel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def forward(
236236
) -> Union[Tensor, LinearOperator]:
237237
r"""
238238
Computes the covariance between :math:`\mathbf x_1` and :math:`\mathbf x_2`.
239-
This method should be imlemented by all Kernel subclasses.
239+
This method should be implemented by all Kernel subclasses.
240240
241241
:param x1: First set of data (... x N x D).
242242
:param x2: Second set of data (... x M x D).

gpytorch/test/base_keops_test_case.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_forward_x1_neq_x2(self, use_keops=True, ard=False, **kwargs):
6666
# The patch makes sure that we're actually using KeOps
6767
k1 = kern1(x1, x2).to_dense()
6868
k2 = kern2(x1, x2).to_dense()
69-
self.assertLess(torch.norm(k1 - k2), 1e-4)
69+
self.assertLess(torch.norm(k1 - k2), 1e-3)
7070

7171
if use_keops:
7272
self.assertTrue(keops_mock.called)
@@ -86,7 +86,7 @@ def test_batch_matmul(self, use_keops=True, **kwargs):
8686
# The patch makes sure that we're actually using KeOps
8787
res1 = kern1(x1, x1).matmul(rhs)
8888
res2 = kern2(x1, x1).matmul(rhs)
89-
self.assertLess(torch.norm(res1 - res2), 1e-4)
89+
self.assertLess(torch.norm(res1 - res2), 1e-3)
9090

9191
if use_keops:
9292
self.assertTrue(keops_mock.called)
@@ -115,7 +115,7 @@ def test_gradient(self, use_keops=True, ard=False, **kwargs):
115115
# stack all gradients into a tensor
116116
grad_s1 = torch.vstack(torch.autograd.grad(s1, [*kern1.hyperparameters()]))
117117
grad_s2 = torch.vstack(torch.autograd.grad(s2, [*kern2.hyperparameters()]))
118-
self.assertAllClose(grad_s1, grad_s2, rtol=1e-4, atol=1e-5)
118+
self.assertAllClose(grad_s1, grad_s2, rtol=1e-3, atol=1e-3)
119119

120120
if use_keops:
121121
self.assertTrue(keops_mock.called)

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def find_version(*file_paths):
3939

4040
torch_min = "1.11"
4141
install_requires = [
42+
"mpmath>=0.19,<=1.3", # avoid incompatibiltiy with torch+sympy with mpmath 1.4
4243
"scikit-learn",
4344
"scipy",
4445
"linear_operator>=0.5.2",

test/examples/test_svgp_gp_classification.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def train_data(cuda=False):
19-
train_x = torch.linspace(0, 1, 260)
19+
train_x = torch.linspace(0, 1, 150)
2020
train_y = torch.cos(train_x * (2 * math.pi)).gt(0).float()
2121
if cuda:
2222
return train_x.cuda(), train_y.cuda()
@@ -49,7 +49,7 @@ class TestSVGPClassification(BaseTestCase, unittest.TestCase):
4949
def test_classification_error(self, cuda=False, mll_cls=gpytorch.mlls.VariationalELBO):
5050
train_x, train_y = train_data(cuda=cuda)
5151
likelihood = BernoulliLikelihood()
52-
model = SVGPClassificationModel(torch.linspace(0, 1, 25))
52+
model = SVGPClassificationModel(torch.linspace(0, 1, 64))
5353
mll = mll_cls(likelihood, model, num_data=len(train_y))
5454
if cuda:
5555
likelihood = likelihood.cuda()
@@ -59,12 +59,12 @@ def test_classification_error(self, cuda=False, mll_cls=gpytorch.mlls.Variationa
5959
# Find optimal model hyperparameters
6060
model.train()
6161
likelihood.train()
62-
optimizer = optim.Adam([{"params": model.parameters()}, {"params": likelihood.parameters()}], lr=0.1)
62+
optimizer = optim.Adam([{"params": model.parameters()}, {"params": likelihood.parameters()}], lr=0.03)
6363

6464
_wrapped_cg = MagicMock(wraps=linear_operator.utils.linear_cg)
6565
_cg_mock = patch("linear_operator.utils.linear_cg", new=_wrapped_cg)
6666
with _cg_mock as cg_mock:
67-
for _ in range(400):
67+
for _ in range(100):
6868
optimizer.zero_grad()
6969
output = model(train_x)
7070
loss = -mll(output, train_y)

0 commit comments

Comments
 (0)