pyro/infer/abstract_infer.py
Killed 1 out of 12 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 257
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -61,7 +61,7 @@
else:
return torch.stack(samples_by_chain, dim=0), torch.stack(weights_by_chain, dim=0)
- def _add_sample(self, value, log_weight=None, chain_id=0):
+ def _add_sample(self, value, log_weight=None, chain_id=1):
"""
Adds a new data point to the sample. The values in successive calls to
``add`` must have the same tensor shape and size. Optionally, an
Mutant 258
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -127,7 +127,7 @@
self._marginals = {site: EmpiricalMarginal(trace_posterior, site, validate)
for site in self.sites}
- def support(self, flatten=False):
+ def support(self, flatten=True):
"""
Gets support of this marginal distribution.
Mutant 259
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -146,7 +146,6 @@
support[site] = samples.reshape(flattened_shape)
return support
- @property
def empirical(self):
"""
A dictionary of sites' names and their corresponding :class:`EmpiricalMarginal`
Mutant 260
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -164,7 +164,7 @@
This is designed to be used by other utility classes like `EmpiricalMarginal`,
that need access to the collected execution traces.
"""
- def __init__(self, num_chains=1):
+ def __init__(self, num_chains=2):
self.num_chains = num_chains
self._reset()
Mutant 262
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -169,7 +169,7 @@
self._reset()
def _reset(self):
- self.log_weights = []
+ self.log_weights = None
self.exec_traces = []
self.chain_ids = [] # chain id corresponding to the sample
self._idx_by_chain = [[] for _ in range(self.num_chains)] # indexes of samples by chain id
Mutant 263
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -170,7 +170,7 @@
def _reset(self):
self.log_weights = []
- self.exec_traces = []
+ self.exec_traces = None
self.chain_ids = [] # chain id corresponding to the sample
self._idx_by_chain = [[] for _ in range(self.num_chains)] # indexes of samples by chain id
self._categorical = None
Mutant 264
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -171,7 +171,7 @@
def _reset(self):
self.log_weights = []
self.exec_traces = []
- self.chain_ids = [] # chain id corresponding to the sample
+ self.chain_ids = None # chain id corresponding to the sample
self._idx_by_chain = [[] for _ in range(self.num_chains)] # indexes of samples by chain id
self._categorical = None
Mutant 265
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -172,7 +172,7 @@
self.log_weights = []
self.exec_traces = []
self.chain_ids = [] # chain id corresponding to the sample
- self._idx_by_chain = [[] for _ in range(self.num_chains)] # indexes of samples by chain id
+ self._idx_by_chain = None # indexes of samples by chain id
self._categorical = None
def marginal(self, sites=None):
Mutant 266
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -173,7 +173,7 @@
self.exec_traces = []
self.chain_ids = [] # chain id corresponding to the sample
self._idx_by_chain = [[] for _ in range(self.num_chains)] # indexes of samples by chain id
- self._categorical = None
+ self._categorical = ""
def marginal(self, sites=None):
"""
Mutant 267
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -186,7 +186,6 @@
"""
return Marginals(self, sites)
- @abstractmethod
def _traces(self, *args, **kwargs):
"""
Abstract method implemented by classes that inherit from `TracePosterior`.
Mutant 268
--- pyro/infer/abstract_infer.py
+++ pyro/infer/abstract_infer.py
@@ -232,7 +232,7 @@
self._categorical = Categorical(logits=torch.tensor(self.log_weights))
return self
- def information_criterion(self, pointwise=False):
+ def information_criterion(self, pointwise=True):
"""
Computes information criterion of the model. Currently, returns only "Widely
Applicable/Watanabe-Akaike Information Criterion" (WAIC) and the corresponding