pyro/infer/svgd.py
Killed 2 out of 14 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 52
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -41,7 +41,6 @@
Abstract class for kernels used in the :class:`SVGD` inference algorithm.
"""
- @abstractmethod
def log_kernel_and_grad(self, particles):
"""
Compute the component kernels and their gradients.
Mutant 53
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -54,8 +54,6 @@
"""
raise NotImplementedError
-
-@copy_docs_from(SteinKernel)
class RBFSteinKernel(SteinKernel):
"""
A RBF kernel for use in the SVGD inference algorithm. The bandwidth of the kernel is chosen from the
Mutant 54
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -89,7 +89,6 @@
assert median.shape == norm_sq.shape[-1:]
return median / math.log(num_particles + 1)
- @torch.no_grad()
def log_kernel_and_grad(self, particles):
delta_x = particles.unsqueeze(0) - particles.unsqueeze(1) # N N D
assert delta_x.dim() == 3
Mutant 56
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -104,7 +104,6 @@
def bandwidth_factor(self):
return self._bandwidth_factor
- @bandwidth_factor.setter
def bandwidth_factor(self, bandwidth_factor):
"""
:param float bandwidth_factor: Optional factor by which to scale the bandwidth
Mutant 57
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -113,8 +113,6 @@
assert bandwidth_factor > 0.0, "bandwidth_factor must be positive."
self._bandwidth_factor = bandwidth_factor
-
-@copy_docs_from(SteinKernel)
class IMQSteinKernel(SteinKernel):
r"""
An IMQ (inverse multi-quadratic) kernel for use in the SVGD inference algorithm [1]. The bandwidth of the kernel
Mutant 58
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -135,7 +135,7 @@
[1] "Stein Points," Wilson Ye Chen, Lester Mackey, Jackson Gorham, Francois-Xavier Briol, Chris. J. Oates.
[2] "Stein Variational Gradient Descent: A General Purpose Bayesian Inference Algorithm," Qiang Liu, Dilin Wang
"""
- def __init__(self, alpha=0.5, beta=-0.5, bandwidth_factor=None):
+ def __init__(self, alpha=1.5, beta=-0.5, bandwidth_factor=None):
"""
:param float alpha: Kernel hyperparameter, defaults to 0.5.
:param float beta: Kernel hyperparameter, defaults to -0.5.
Mutant 59
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -135,7 +135,7 @@
[1] "Stein Points," Wilson Ye Chen, Lester Mackey, Jackson Gorham, Francois-Xavier Briol, Chris. J. Oates.
[2] "Stein Variational Gradient Descent: A General Purpose Bayesian Inference Algorithm," Qiang Liu, Dilin Wang
"""
- def __init__(self, alpha=0.5, beta=-0.5, bandwidth_factor=None):
+ def __init__(self, alpha=0.5, beta=+0.5, bandwidth_factor=None):
"""
:param float alpha: Kernel hyperparameter, defaults to 0.5.
:param float beta: Kernel hyperparameter, defaults to -0.5.
Mutant 60
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -135,7 +135,7 @@
[1] "Stein Points," Wilson Ye Chen, Lester Mackey, Jackson Gorham, Francois-Xavier Briol, Chris. J. Oates.
[2] "Stein Variational Gradient Descent: A General Purpose Bayesian Inference Algorithm," Qiang Liu, Dilin Wang
"""
- def __init__(self, alpha=0.5, beta=-0.5, bandwidth_factor=None):
+ def __init__(self, alpha=0.5, beta=-1.5, bandwidth_factor=None):
"""
:param float alpha: Kernel hyperparameter, defaults to 0.5.
:param float beta: Kernel hyperparameter, defaults to -0.5.
Mutant 61
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -160,7 +160,6 @@
assert median.shape == norm_sq.shape[-1:]
return median / math.log(num_particles + 1)
- @torch.no_grad()
def log_kernel_and_grad(self, particles):
delta_x = particles.unsqueeze(0) - particles.unsqueeze(1) # N N D
assert delta_x.dim() == 3
Mutant 63
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -177,7 +177,6 @@
def bandwidth_factor(self):
return self._bandwidth_factor
- @bandwidth_factor.setter
def bandwidth_factor(self, bandwidth_factor):
"""
:param float bandwidth_factor: Optional factor by which to scale the bandwidth
Mutant 64
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -224,7 +224,7 @@
[2] "Kernelized Complete Conditional Stein Discrepancy,"
Raghav Singhal, Saad Lahlou, Rajesh Ranganath
"""
- def __init__(self, model, kernel, optim, num_particles, max_plate_nesting, mode="univariate"):
+ def __init__(self, model, kernel, optim, num_particles, max_plate_nesting, mode="XXunivariateXX"):
assert callable(model)
assert isinstance(kernel, SteinKernel), "Must provide a valid SteinKernel"
assert isinstance(optim, pyro.optim.PyroOptim), "Must provide a valid Pyro optimizer"
Mutant 65
--- pyro/infer/svgd.py
+++ pyro/infer/svgd.py
@@ -250,7 +250,6 @@
return {site["name"]: biject_to(site["fn"].support)(unconstrained_value)
for site, unconstrained_value in self.guide._unpack_latent(pyro.param("svgd_particles"))}
- @torch.no_grad()
def step(self, *args, **kwargs):
"""
Computes the SVGD gradient, passing args and kwargs to the model,