@@ -158,7 +158,7 @@ def _draw_likelihood_samples(
158
158
with pyro .plate (plate_name , size = num_samples , dim = (- max_plate_nesting - 1 )):
159
159
if sample_shape is None :
160
160
function_samples = pyro .sample (self .name_prefix , function_dist .mask (False ))
161
- # Deal with the fact that we're not assuming conditional indendence over data points here
161
+ # Deal with the fact that we're not assuming conditional independence over data points here
162
162
function_samples = function_samples .squeeze (- len (function_dist .event_shape ) - 1 )
163
163
else :
164
164
sample_shape = sample_shape [: - len (function_dist .batch_shape )]
@@ -182,8 +182,8 @@ def expected_log_prob(
182
182
183
183
:param observations: Values of :math:`y`.
184
184
:param function_dist: Distribution for :math:`f(x)`.
185
- :param args: Additional args (passed to the foward function).
186
- :param kwargs: Additional kwargs (passed to the foward function).
185
+ :param args: Additional args (passed to the forward function).
186
+ :param kwargs: Additional kwargs (passed to the forward function).
187
187
"""
188
188
return super ().expected_log_prob (observations , function_dist , * args , ** kwargs )
189
189
@@ -225,8 +225,8 @@ def log_marginal(
225
225
226
226
:param observations: Values of :math:`y`.
227
227
:param function_dist: Distribution for :math:`f(x)`.
228
- :param args: Additional args (passed to the foward function).
229
- :param kwargs: Additional kwargs (passed to the foward function).
228
+ :param args: Additional args (passed to the forward function).
229
+ :param kwargs: Additional kwargs (passed to the forward function).
230
230
"""
231
231
return super ().log_marginal (observations , function_dist , * args , ** kwargs )
232
232
@@ -243,8 +243,8 @@ def marginal(self, function_dist: MultivariateNormal, *args: Any, **kwargs: Any)
243
243
(co)variance of :math:`p(\mathbf f|...)`.
244
244
245
245
:param function_dist: Distribution for :math:`f(x)`.
246
- :param args: Additional args (passed to the foward function).
247
- :param kwargs: Additional kwargs (passed to the foward function).
246
+ :param args: Additional args (passed to the forward function).
247
+ :param kwargs: Additional kwargs (passed to the forward function).
248
248
:return: The marginal distribution, or samples from it.
249
249
"""
250
250
return super ().marginal (function_dist , * args , ** kwargs )
@@ -259,8 +259,8 @@ def pyro_guide(self, function_dist: MultivariateNormal, target: Tensor, *args: A
259
259
:param function_dist: Distribution of latent function
260
260
:math:`q(\mathbf f)`.
261
261
:param target: Observed :math:`\mathbf y`.
262
- :param args: Additional args (passed to the foward function).
263
- :param kwargs: Additional kwargs (passed to the foward function).
262
+ :param args: Additional args (passed to the forward function).
263
+ :param kwargs: Additional kwargs (passed to the forward function).
264
264
"""
265
265
with pyro .plate (self .name_prefix + ".data_plate" , dim = - 1 ):
266
266
pyro .sample (self .name_prefix + ".f" , function_dist )
@@ -276,8 +276,8 @@ def pyro_model(self, function_dist: MultivariateNormal, target: Tensor, *args: A
276
276
:param function_dist: Distribution of latent function
277
277
:math:`p(\mathbf f)`.
278
278
:param target: Observed :math:`\mathbf y`.
279
- :param args: Additional args (passed to the foward function).
280
- :param kwargs: Additional kwargs (passed to the foward function).
279
+ :param args: Additional args (passed to the forward function).
280
+ :param kwargs: Additional kwargs (passed to the forward function).
281
281
"""
282
282
with pyro .plate (self .name_prefix + ".data_plate" , dim = - 1 ):
283
283
function_samples = pyro .sample (self .name_prefix + ".f" , function_dist )
@@ -324,17 +324,17 @@ def __call__(self, input: Union[Tensor, MultivariateNormal], *args: Any, **kwarg
324
324
325
325
# Analytic marginal computation - Bernoulli and Gaussian likelihoods only
326
326
analytic_marginal_likelihood = gpytorch.likelihoods.GaussianLikelihood()
327
- marginal = analytic_marginal_likeihood (f)
327
+ marginal = analytic_marginal_likelihood (f)
328
328
print(type(marginal), marginal.batch_shape, marginal.event_shape)
329
- # >>> gpytorch.distributions.MultivariateNormal, torch.Size([]), torch.Size([20])
329
+ # >>> <class ' gpytorch.distributions.multivariate_normal. MultivariateNormal'> torch.Size([]) torch.Size([20]) # noqa: E501
330
330
331
331
# MC marginal computation - all other likelihoods
332
332
mc_marginal_likelihood = gpytorch.likelihoods.BetaLikelihood()
333
333
with gpytorch.settings.num_likelihood_samples(15):
334
- marginal = analytic_marginal_likeihood (f)
334
+ marginal = mc_marginal_likelihood (f)
335
335
print(type(marginal), marginal.batch_shape, marginal.event_shape)
336
- # >>> torch.distributions.Beta, torch.Size([15, 20]), torch.Size([])
337
- # ( The batch_shape of torch.Size([15, 20]) represents 15 MC samples for 20 data points.
336
+ # >>> <class ' torch.distributions.beta. Beta'> torch.Size([15, 20]) torch.Size([])
337
+ # The batch_shape torch.Size([15, 20]) represents 15 MC samples for 20 data points.
338
338
339
339
.. note::
340
340
@@ -344,8 +344,8 @@ def __call__(self, input: Union[Tensor, MultivariateNormal], *args: Any, **kwarg
344
344
345
345
:param input: Either a (... x N) sample from :math:`\mathbf f`
346
346
or a (... x N) MVN distribution of :math:`\mathbf f`.
347
- :param args: Additional args (passed to the foward function).
348
- :param kwargs: Additional kwargs (passed to the foward function).
347
+ :param args: Additional args (passed to the forward function).
348
+ :param kwargs: Additional kwargs (passed to the forward function).
349
349
:return: Either a conditional :math:`p(\mathbf y \mid \mathbf f)`
350
350
or marginal :math:`p(\mathbf y)`
351
351
based on whether :attr:`input` is a Tensor or a MultivariateNormal (see above).
@@ -377,21 +377,21 @@ def __call__(self, input: Union[Tensor, MultivariateNormal], *args: Any, **kwarg
377
377
class Likelihood (_Likelihood ):
378
378
@property
379
379
def num_data (self ) -> int :
380
- warnings .warn ("num_data is only used for likehoods that are integrated with Pyro." , RuntimeWarning )
380
+ warnings .warn ("num_data is only used for likelihoods that are integrated with Pyro." , RuntimeWarning )
381
381
return 0
382
382
383
383
@num_data .setter
384
384
def num_data (self , val : int ) -> None :
385
- warnings .warn ("num_data is only used for likehoods that are integrated with Pyro." , RuntimeWarning )
385
+ warnings .warn ("num_data is only used for likelihoods that are integrated with Pyro." , RuntimeWarning )
386
386
387
387
@property
388
388
def name_prefix (self ) -> str :
389
- warnings .warn ("name_prefix is only used for likehoods that are integrated with Pyro." , RuntimeWarning )
389
+ warnings .warn ("name_prefix is only used for likelihoods that are integrated with Pyro." , RuntimeWarning )
390
390
return ""
391
391
392
392
@name_prefix .setter
393
393
def name_prefix (self , val : str ) -> None :
394
- warnings .warn ("name_prefix is only used for likehoods that are integrated with Pyro." , RuntimeWarning )
394
+ warnings .warn ("name_prefix is only used for likelihoods that are integrated with Pyro." , RuntimeWarning )
395
395
396
396
397
397
class _OneDimensionalLikelihood (Likelihood , ABC ):
0 commit comments