pymc3/step_methods/hmc/base_hmc.py
Killed 32 out of 73 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 678
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -26,7 +26,7 @@
from pymc3.backends.report import SamplerWarning, WarningType
from pymc3.exceptions import SamplingError
-logger = logging.getLogger("pymc3")
+logger = logging.getLogger("XXpymc3XX")
HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
Mutant 679
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -26,7 +26,7 @@
from pymc3.backends.report import SamplerWarning, WarningType
from pymc3.exceptions import SamplingError
-logger = logging.getLogger("pymc3")
+logger = None
HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
Mutant 680
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -28,7 +28,7 @@
logger = logging.getLogger("pymc3")
-HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
+HMCStepData = namedtuple("XXHMCStepDataXX", "end, accept_stat, divergence_info, stats")
DivergenceInfo = namedtuple("DivergenceInfo", "message, exec_info, state")
Mutant 683
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -31,7 +31,7 @@
HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
-DivergenceInfo = namedtuple("DivergenceInfo", "message, exec_info, state")
+DivergenceInfo = namedtuple("XXDivergenceInfoXX", "message, exec_info, state")
class BaseHMC(arraystep.GradientSharedStep):
"""Superclass to implement Hamiltonian/hybrid monte carlo."""
Mutant 684
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -31,7 +31,7 @@
HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
-DivergenceInfo = namedtuple("DivergenceInfo", "message, exec_info, state")
+DivergenceInfo = namedtuple("DivergenceInfo", "XXmessage, exec_info, stateXX")
class BaseHMC(arraystep.GradientSharedStep):
"""Superclass to implement Hamiltonian/hybrid monte carlo."""
Mutant 685
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -31,7 +31,7 @@
HMCStepData = namedtuple("HMCStepData", "end, accept_stat, divergence_info, stats")
-DivergenceInfo = namedtuple("DivergenceInfo", "message, exec_info, state")
+DivergenceInfo = None
class BaseHMC(arraystep.GradientSharedStep):
"""Superclass to implement Hamiltonian/hybrid monte carlo."""
Mutant 686
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -36,7 +36,7 @@
class BaseHMC(arraystep.GradientSharedStep):
"""Superclass to implement Hamiltonian/hybrid monte carlo."""
- default_blocked = True
+ default_blocked = False
def __init__(
self,
Mutant 687
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -36,7 +36,7 @@
class BaseHMC(arraystep.GradientSharedStep):
"""Superclass to implement Hamiltonian/hybrid monte carlo."""
- default_blocked = True
+ default_blocked = None
def __init__(
self,
Mutant 692
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -85,7 +85,7 @@
super().__init__(vars, blocked=blocked, model=model, dtype=dtype, **theano_kwargs)
- self.adapt_step_size = adapt_step_size
+ self.adapt_step_size = None
self.Emax = Emax
self.iter_count = 0
size = self._logp_dlogp_func.size
Mutant 694
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -87,7 +87,7 @@
self.adapt_step_size = adapt_step_size
self.Emax = Emax
- self.iter_count = 0
+ self.iter_count = 1
size = self._logp_dlogp_func.size
self.step_size = step_scale / (size ** 0.25)
Mutant 697
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -90,7 +90,7 @@
self.iter_count = 0
size = self._logp_dlogp_func.size
- self.step_size = step_scale / (size ** 0.25)
+ self.step_size = step_scale * (size ** 0.25)
self.step_adapt = step_sizes.DualAverageAdaptation(
self.step_size, target_accept, gamma, k, t0
)
Mutant 699
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -90,7 +90,7 @@
self.iter_count = 0
size = self._logp_dlogp_func.size
- self.step_size = step_scale / (size ** 0.25)
+ self.step_size = step_scale / (size ** 1.25)
self.step_adapt = step_sizes.DualAverageAdaptation(
self.step_size, target_accept, gamma, k, t0
)
Mutant 701
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -94,7 +94,7 @@
self.step_adapt = step_sizes.DualAverageAdaptation(
self.step_size, target_accept, gamma, k, t0
)
- self.target_accept = target_accept
+ self.target_accept = None
self.tune = True
if scaling is None and potential is None:
Mutant 704
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -97,7 +97,7 @@
self.target_accept = target_accept
self.tune = True
- if scaling is None and potential is None:
+ if scaling is not None and potential is None:
mean = floatX(np.zeros(size))
var = floatX(np.ones(size))
potential = QuadPotentialDiagAdapt(size, mean, var, 10)
Mutant 705
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -97,7 +97,7 @@
self.target_accept = target_accept
self.tune = True
- if scaling is None and potential is None:
+ if scaling is None and potential is not None:
mean = floatX(np.zeros(size))
var = floatX(np.ones(size))
potential = QuadPotentialDiagAdapt(size, mean, var, 10)
Mutant 706
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -97,7 +97,7 @@
self.target_accept = target_accept
self.tune = True
- if scaling is None and potential is None:
+ if scaling is None or potential is None:
mean = floatX(np.zeros(size))
var = floatX(np.ones(size))
potential = QuadPotentialDiagAdapt(size, mean, var, 10)
Mutant 708
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -106,7 +106,7 @@
point = Point(scaling, model=model)
scaling = guess_scaling(point, model=model, vars=vars)
- if scaling is not None and potential is not None:
+ if scaling is not None and potential is None:
raise ValueError("Can not specify both potential and scaling.")
if potential is not None:
Mutant 712
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -118,7 +118,7 @@
self.potential, self._logp_dlogp_func
)
- self._step_rand = step_rand
+ self._step_rand = None
self._warnings = []
self._samples_after_tune = 0
self._num_divs_sample = 0
Mutant 714
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -120,7 +120,7 @@
self._step_rand = step_rand
self._warnings = []
- self._samples_after_tune = 0
+ self._samples_after_tune = 1
self._num_divs_sample = 0
def _hamiltonian_step(self, start, p0, step_size):
Mutant 716
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -121,7 +121,7 @@
self._step_rand = step_rand
self._warnings = []
self._samples_after_tune = 0
- self._num_divs_sample = 0
+ self._num_divs_sample = 1
def _hamiltonian_step(self, start, p0, step_size):
"""Compute one hamiltonian trajectory and return the next state.
Mutant 722
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -157,7 +157,7 @@
self._warnings.append(warning)
raise SamplingError("Bad initial energy")
- adapt_step = self.tune and self.adapt_step_size
+ adapt_step = None
step_size = self.step_adapt.current(adapt_step)
self.step_size = step_size
Mutant 724
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -159,7 +159,7 @@
adapt_step = self.tune and self.adapt_step_size
step_size = self.step_adapt.current(adapt_step)
- self.step_size = step_size
+ self.step_size = None
if self._step_rand is not None:
step_size = self._step_rand(step_size)
Mutant 727
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -169,7 +169,7 @@
self.step_adapt.update(hmc_step.accept_stat, adapt_step)
self.potential.update(hmc_step.end.q, hmc_step.end.q_grad, self.tune)
if hmc_step.divergence_info:
- info = hmc_step.divergence_info
+ info = None
if self.tune:
kind = WarningType.TUNING_DIVERGENCE
point = None
Mutant 728
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -171,7 +171,7 @@
if hmc_step.divergence_info:
info = hmc_step.divergence_info
if self.tune:
- kind = WarningType.TUNING_DIVERGENCE
+ kind = None
point = None
else:
kind = WarningType.DIVERGENCE
Mutant 729
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -172,7 +172,7 @@
info = hmc_step.divergence_info
if self.tune:
kind = WarningType.TUNING_DIVERGENCE
- point = None
+ point = ""
else:
kind = WarningType.DIVERGENCE
self._num_divs_sample += 1
Mutant 730
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -182,7 +182,7 @@
else:
point = None
warning = SamplerWarning(
- kind, info.message, "debug", self.iter_count, info.exec_info, point
+ kind, info.message, "XXdebugXX", self.iter_count, info.exec_info, point
)
self._warnings.append(warning)
Mutant 731
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -187,7 +187,7 @@
self._warnings.append(warning)
- self.iter_count += 1
+ self.iter_count = 1
if not self.tune:
self._samples_after_tune += 1
Mutant 732
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -187,7 +187,7 @@
self._warnings.append(warning)
- self.iter_count += 1
+ self.iter_count -= 1
if not self.tune:
self._samples_after_tune += 1
Mutant 733
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -187,7 +187,7 @@
self._warnings.append(warning)
- self.iter_count += 1
+ self.iter_count += 2
if not self.tune:
self._samples_after_tune += 1
Mutant 734
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -188,7 +188,7 @@
self._warnings.append(warning)
self.iter_count += 1
- if not self.tune:
+ if self.tune:
self._samples_after_tune += 1
stats = {"tune": self.tune, "diverging": bool(hmc_step.divergence_info)}
Mutant 735
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -189,7 +189,7 @@
self.iter_count += 1
if not self.tune:
- self._samples_after_tune += 1
+ self._samples_after_tune = 1
stats = {"tune": self.tune, "diverging": bool(hmc_step.divergence_info)}
Mutant 736
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -189,7 +189,7 @@
self.iter_count += 1
if not self.tune:
- self._samples_after_tune += 1
+ self._samples_after_tune -= 1
stats = {"tune": self.tune, "diverging": bool(hmc_step.divergence_info)}
Mutant 737
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -189,7 +189,7 @@
self.iter_count += 1
if not self.tune:
- self._samples_after_tune += 1
+ self._samples_after_tune += 2
stats = {"tune": self.tune, "diverging": bool(hmc_step.divergence_info)}
Mutant 742
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -207,7 +207,7 @@
warnings = self._warnings[:]
# Generate a global warning for divergences
- message = ""
+ message = "XXXX"
n_divs = self._num_divs_sample
if n_divs and self._samples_after_tune == n_divs:
message = (
Mutant 743
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -207,7 +207,7 @@
warnings = self._warnings[:]
# Generate a global warning for divergences
- message = ""
+ message = None
n_divs = self._num_divs_sample
if n_divs and self._samples_after_tune == n_divs:
message = (
Mutant 745
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -209,7 +209,7 @@
# Generate a global warning for divergences
message = ""
n_divs = self._num_divs_sample
- if n_divs and self._samples_after_tune == n_divs:
+ if n_divs and self._samples_after_tune != n_divs:
message = (
"The chain contains only diverging samples. The model "
"is probably misspecified."
Mutant 746
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -209,7 +209,7 @@
# Generate a global warning for divergences
message = ""
n_divs = self._num_divs_sample
- if n_divs and self._samples_after_tune == n_divs:
+ if n_divs or self._samples_after_tune == n_divs:
message = (
"The chain contains only diverging samples. The model "
"is probably misspecified."
Mutant 747
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -214,7 +214,7 @@
"The chain contains only diverging samples. The model "
"is probably misspecified."
)
- elif n_divs == 1:
+ elif n_divs != 1:
message = (
"There was 1 divergence after tuning. Increase "
"`target_accept` or reparameterize."
Mutant 748
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -214,7 +214,7 @@
"The chain contains only diverging samples. The model "
"is probably misspecified."
)
- elif n_divs == 1:
+ elif n_divs == 2:
message = (
"There was 1 divergence after tuning. Increase "
"`target_accept` or reparameterize."
Mutant 749
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -219,7 +219,7 @@
"There was 1 divergence after tuning. Increase "
"`target_accept` or reparameterize."
)
- elif n_divs > 1:
+ elif n_divs >= 1:
message = (
"There were %s divergences after tuning. Increase "
"`target_accept` or reparameterize." % n_divs
Mutant 750
--- pymc3/step_methods/hmc/base_hmc.py
+++ pymc3/step_methods/hmc/base_hmc.py
@@ -219,7 +219,7 @@
"There was 1 divergence after tuning. Increase "
"`target_accept` or reparameterize."
)
- elif n_divs > 1:
+ elif n_divs > 2:
message = (
"There were %s divergences after tuning. Increase "
"`target_accept` or reparameterize." % n_divs