bambi/backends/pymc.py
Killed 42 out of 68 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 556
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -15,7 +15,7 @@
links = {
"identity": lambda x: x,
"logit": theano.tensor.nnet.sigmoid,
- "inverse": theano.tensor.inv,
+ "XXinverseXX": theano.tensor.inv,
"inverse_squared": lambda x: theano.tensor.inv(theano.tensor.sqrt(x)),
"log": theano.tensor.exp,
}
Mutant 557
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -16,7 +16,7 @@
"identity": lambda x: x,
"logit": theano.tensor.nnet.sigmoid,
"inverse": theano.tensor.inv,
- "inverse_squared": lambda x: theano.tensor.inv(theano.tensor.sqrt(x)),
+ "XXinverse_squaredXX": lambda x: theano.tensor.inv(theano.tensor.sqrt(x)),
"log": theano.tensor.exp,
}
Mutant 558
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -16,7 +16,7 @@
"identity": lambda x: x,
"logit": theano.tensor.nnet.sigmoid,
"inverse": theano.tensor.inv,
- "inverse_squared": lambda x: theano.tensor.inv(theano.tensor.sqrt(x)),
+ "inverse_squared": lambda x: None,
"log": theano.tensor.exp,
}
Mutant 559
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -17,7 +17,7 @@
"logit": theano.tensor.nnet.sigmoid,
"inverse": theano.tensor.inv,
"inverse_squared": lambda x: theano.tensor.inv(theano.tensor.sqrt(x)),
- "log": theano.tensor.exp,
+ "XXlogXX": theano.tensor.exp,
}
dists = {"HalfFlat": pm.Bound(pm.Flat, lower=0)}
Mutant 560
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -20,7 +20,7 @@
"log": theano.tensor.exp,
}
- dists = {"HalfFlat": pm.Bound(pm.Flat, lower=0)}
+ dists = {"XXHalfFlatXX": pm.Bound(pm.Flat, lower=0)}
def __init__(self):
self.reset()
Mutant 562
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -20,7 +20,7 @@
"log": theano.tensor.exp,
}
- dists = {"HalfFlat": pm.Bound(pm.Flat, lower=0)}
+ dists = None
def __init__(self):
self.reset()
Mutant 563
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -26,7 +26,7 @@
self.reset()
# Attributes defined elsewhere
- self.mu = None # build()
+ self.mu = "" # build()
self.spec = None # build()
self.trace = None # build()
self.advi_params = None # build()
Mutant 564
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -27,7 +27,7 @@
# Attributes defined elsewhere
self.mu = None # build()
- self.spec = None # build()
+ self.spec = "" # build()
self.trace = None # build()
self.advi_params = None # build()
Mutant 565
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -28,7 +28,7 @@
# Attributes defined elsewhere
self.mu = None # build()
self.spec = None # build()
- self.trace = None # build()
+ self.trace = "" # build()
self.advi_params = None # build()
def reset(self):
Mutant 566
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -29,7 +29,7 @@
self.mu = None # build()
self.spec = None # build()
self.trace = None # build()
- self.advi_params = None # build()
+ self.advi_params = "" # build()
def reset(self):
"""Reset PyMC3 model and all tracked distributions and parameters."""
Mutant 568
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -34,7 +34,7 @@
def reset(self):
"""Reset PyMC3 model and all tracked distributions and parameters."""
self.model = pm.Model()
- self.mu = None
+ self.mu = ""
self.par_groups = {}
def _build_dist(self, spec, label, dist, **kwargs):
Mutant 569
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -35,7 +35,7 @@
"""Reset PyMC3 model and all tracked distributions and parameters."""
self.model = pm.Model()
self.mu = None
- self.par_groups = {}
+ self.par_groups = None
def _build_dist(self, spec, label, dist, **kwargs):
"""Build and return a PyMC3 Distribution."""
Mutant 573
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -61,7 +61,7 @@
# Non-centered parameterization for hyperpriors
if (
spec.noncentered
- and "sigma" in kwargs
+ and "XXsigmaXX" in kwargs
and "observed" not in kwargs
and isinstance(kwargs["sigma"], pm.model.TransformedRV)
):
Mutant 574
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -61,7 +61,7 @@
# Non-centered parameterization for hyperpriors
if (
spec.noncentered
- and "sigma" in kwargs
+ and "sigma" not in kwargs
and "observed" not in kwargs
and isinstance(kwargs["sigma"], pm.model.TransformedRV)
):
Mutant 582
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -66,7 +66,7 @@
and isinstance(kwargs["sigma"], pm.model.TransformedRV)
):
old_sigma = kwargs["sigma"]
- _offset = pm.Normal(label + "_offset", mu=0, sigma=1, shape=kwargs["shape"])
+ _offset = pm.Normal(label + "XX_offsetXX", mu=0, sigma=1, shape=kwargs["shape"])
return pm.Deterministic(label, _offset * old_sigma)
return dist(label, **kwargs)
Mutant 583
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -66,7 +66,7 @@
and isinstance(kwargs["sigma"], pm.model.TransformedRV)
):
old_sigma = kwargs["sigma"]
- _offset = pm.Normal(label + "_offset", mu=0, sigma=1, shape=kwargs["shape"])
+ _offset = pm.Normal(label + "_offset", mu=1, sigma=1, shape=kwargs["shape"])
return pm.Deterministic(label, _offset * old_sigma)
return dist(label, **kwargs)
Mutant 584
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -66,7 +66,7 @@
and isinstance(kwargs["sigma"], pm.model.TransformedRV)
):
old_sigma = kwargs["sigma"]
- _offset = pm.Normal(label + "_offset", mu=0, sigma=1, shape=kwargs["shape"])
+ _offset = pm.Normal(label + "_offset", mu=0, sigma=2, shape=kwargs["shape"])
return pm.Deterministic(label, _offset * old_sigma)
return dist(label, **kwargs)
Mutant 587
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -67,7 +67,7 @@
):
old_sigma = kwargs["sigma"]
_offset = pm.Normal(label + "_offset", mu=0, sigma=1, shape=kwargs["shape"])
- return pm.Deterministic(label, _offset * old_sigma)
+ return pm.Deterministic(label, _offset / old_sigma)
return dist(label, **kwargs)
Mutant 588
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -71,7 +71,7 @@
return dist(label, **kwargs)
- def build(self, spec, reset=True): # pylint: disable=arguments-differ
+ def build(self, spec, reset=False): # pylint: disable=arguments-differ
"""Compile the PyMC3 model from an abstract model specification.
Parameters
Mutant 589
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -85,7 +85,7 @@
self.reset()
with self.model:
- self.mu = 0.0
+ self.mu = 1.0
for t in spec.terms.values():
data = t.data
Mutant 598
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -98,7 +98,7 @@
coef = self._build_dist(spec, label, dist_name, shape=n_cols, **dist_args)
if t.random:
- self.mu += coef[t.group_index][:, None] * t.predictor
+ self.mu = coef[t.group_index][:, None] * t.predictor
else:
self.mu += pm.math.dot(data, coef)[:, None]
Mutant 599
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -98,7 +98,7 @@
coef = self._build_dist(spec, label, dist_name, shape=n_cols, **dist_args)
if t.random:
- self.mu += coef[t.group_index][:, None] * t.predictor
+ self.mu -= coef[t.group_index][:, None] * t.predictor
else:
self.mu += pm.math.dot(data, coef)[:, None]
Mutant 602
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -100,7 +100,7 @@
if t.random:
self.mu += coef[t.group_index][:, None] * t.predictor
else:
- self.mu += pm.math.dot(data, coef)[:, None]
+ self.mu -= pm.math.dot(data, coef)[:, None]
y = spec.y.data
y_prior = spec.family.prior
Mutant 610
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -112,7 +112,7 @@
y_prior.args[spec.family.parent] = link_f(self.mu)
y_prior.args["observed"] = y
self._build_dist(spec, spec.y.name, y_prior.name, **y_prior.args)
- self.spec = spec
+ self.spec = None
# pylint: disable=arguments-differ, inconsistent-return-statements
def run(self, start=None, method="mcmc", init="auto", n_init=50000, **kwargs):
Mutant 613
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -115,7 +115,7 @@
self.spec = spec
# pylint: disable=arguments-differ, inconsistent-return-statements
- def run(self, start=None, method="mcmc", init="auto", n_init=50000, **kwargs):
+ def run(self, start=None, method="mcmc", init="auto", n_init=50001, **kwargs):
"""Run the PyMC3 MCMC sampler.
Parameters
Mutant 618
--- bambi/backends/pymc.py
+++ bambi/backends/pymc.py
@@ -143,7 +143,7 @@
model = self.model
if method.lower() == "mcmc":
- samples = kwargs.pop("samples", 1000)
+ samples = kwargs.pop("samples", 1001)
with model:
self.trace = pm.sample(samples, start=start, init=init, n_init=n_init, **kwargs)