pymc3/step_methods/arraystep.py

Killed 42 out of 75 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 226

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -23,8 +23,6 @@
 __all__ = [
     'ArrayStep', 'ArrayStepShared', 'metrop_select', 'Competence']
 
-
-@unique
 class Competence(IntEnum):
     """Enum for charaterizing competence classes of step methods.
     Values include:

Mutant 233

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -36,7 +36,7 @@
     INCOMPATIBLE = 0
     COMPATIBLE = 1
     PREFERRED = 2
-    IDEAL = 3
+    IDEAL = 4
 
 
 class BlockedStep:

Mutant 235

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -41,7 +41,7 @@
 
 class BlockedStep:
 
-    generates_stats = False
+    generates_stats = True
 
     def __new__(cls, *args, **kwargs):
         blocked = kwargs.get('blocked')

Mutant 236

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -41,7 +41,7 @@
 
 class BlockedStep:
 
-    generates_stats = False
+    generates_stats = None
 
     def __new__(cls, *args, **kwargs):
         blocked = kwargs.get('blocked')

Mutant 237

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -44,7 +44,7 @@
     generates_stats = False
 
     def __new__(cls, *args, **kwargs):
-        blocked = kwargs.get('blocked')
+        blocked = kwargs.get('XXblockedXX')
         if blocked is None:
             # Try to look up default value from class
             blocked = getattr(cls, 'default_blocked', True)

Mutant 238

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -44,7 +44,7 @@
     generates_stats = False
 
     def __new__(cls, *args, **kwargs):
-        blocked = kwargs.get('blocked')
+        blocked = None
         if blocked is None:
             # Try to look up default value from class
             blocked = getattr(cls, 'default_blocked', True)

Mutant 239

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -45,7 +45,7 @@
 
     def __new__(cls, *args, **kwargs):
         blocked = kwargs.get('blocked')
-        if blocked is None:
+        if blocked is not None:
             # Try to look up default value from class
             blocked = getattr(cls, 'default_blocked', True)
             kwargs['blocked'] = blocked

Mutant 240

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -47,7 +47,7 @@
         blocked = kwargs.get('blocked')
         if blocked is None:
             # Try to look up default value from class
-            blocked = getattr(cls, 'default_blocked', True)
+            blocked = getattr(cls, 'XXdefault_blockedXX', True)
             kwargs['blocked'] = blocked
 
         model = modelcontext(kwargs.get('model'))

Mutant 241

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -47,7 +47,7 @@
         blocked = kwargs.get('blocked')
         if blocked is None:
             # Try to look up default value from class
-            blocked = getattr(cls, 'default_blocked', True)
+            blocked = getattr(cls, 'default_blocked', False)
             kwargs['blocked'] = blocked
 
         model = modelcontext(kwargs.get('model'))

Mutant 242

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -47,7 +47,7 @@
         blocked = kwargs.get('blocked')
         if blocked is None:
             # Try to look up default value from class
-            blocked = getattr(cls, 'default_blocked', True)
+            blocked = None
             kwargs['blocked'] = blocked
 
         model = modelcontext(kwargs.get('model'))

Mutant 243

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -48,7 +48,7 @@
         if blocked is None:
             # Try to look up default value from class
             blocked = getattr(cls, 'default_blocked', True)
-            kwargs['blocked'] = blocked
+            kwargs['XXblockedXX'] = blocked
 
         model = modelcontext(kwargs.get('model'))
         kwargs.update({'model':model})

Mutant 244

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -48,7 +48,7 @@
         if blocked is None:
             # Try to look up default value from class
             blocked = getattr(cls, 'default_blocked', True)
-            kwargs['blocked'] = blocked
+            kwargs['blocked'] = None
 
         model = modelcontext(kwargs.get('model'))
         kwargs.update({'model':model})

Mutant 245

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -50,7 +50,7 @@
             blocked = getattr(cls, 'default_blocked', True)
             kwargs['blocked'] = blocked
 
-        model = modelcontext(kwargs.get('model'))
+        model = modelcontext(kwargs.get('XXmodelXX'))
         kwargs.update({'model':model})
 
         # vars can either be first arg or a kwarg

Mutant 247

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -51,7 +51,7 @@
             kwargs['blocked'] = blocked
 
         model = modelcontext(kwargs.get('model'))
-        kwargs.update({'model':model})
+        kwargs.update({'XXmodelXX':model})
 
         # vars can either be first arg or a kwarg
         if 'vars' not in kwargs and len(args) >= 1:

Mutant 248

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -54,7 +54,7 @@
         kwargs.update({'model':model})
 
         # vars can either be first arg or a kwarg
-        if 'vars' not in kwargs and len(args) >= 1:
+        if 'XXvarsXX' not in kwargs and len(args) >= 1:
             vars = args[0]
             args = args[1:]
         elif 'vars' in kwargs:

Mutant 249

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -54,7 +54,7 @@
         kwargs.update({'model':model})
 
         # vars can either be first arg or a kwarg
-        if 'vars' not in kwargs and len(args) >= 1:
+        if 'vars'  in kwargs and len(args) >= 1:
             vars = args[0]
             args = args[1:]
         elif 'vars' in kwargs:

Mutant 250

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -54,7 +54,7 @@
         kwargs.update({'model':model})
 
         # vars can either be first arg or a kwarg
-        if 'vars' not in kwargs and len(args) >= 1:
+        if 'vars' not in kwargs and len(args) > 1:
             vars = args[0]
             args = args[1:]
         elif 'vars' in kwargs:

Mutant 251

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -54,7 +54,7 @@
         kwargs.update({'model':model})
 
         # vars can either be first arg or a kwarg
-        if 'vars' not in kwargs and len(args) >= 1:
+        if 'vars' not in kwargs and len(args) >= 2:
             vars = args[0]
             args = args[1:]
         elif 'vars' in kwargs:

Mutant 253

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -57,7 +57,7 @@
         if 'vars' not in kwargs and len(args) >= 1:
             vars = args[0]
             args = args[1:]
-        elif 'vars' in kwargs:
+        elif 'XXvarsXX' in kwargs:
             vars = kwargs.pop('vars')
         else:  # Assume all model variables
             vars = model.vars

Mutant 259

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -68,7 +68,7 @@
         if len(vars) == 0:
             raise ValueError('No free random variables to sample.')
 
-        if not blocked and len(vars) > 1:
+        if  blocked and len(vars) > 1:
             # In this case we create a separate sampler for each var
             # and append them to a CompoundStep
             steps = []

Mutant 261

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -68,7 +68,7 @@
         if len(vars) == 0:
             raise ValueError('No free random variables to sample.')
 
-        if not blocked and len(vars) > 1:
+        if not blocked and len(vars) > 2:
             # In this case we create a separate sampler for each var
             # and append them to a CompoundStep
             steps = []

Mutant 265

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -85,7 +85,7 @@
         else:
             step = super().__new__(cls)
             # Hack for creating the class correctly when unpickling.
-            step.__newargs = (vars, ) + args, kwargs
+            step.__newargs = None
             return step
 
     # Hack for creating the class correctly when unpickling.

Mutant 266

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -92,7 +92,6 @@
     def __getnewargs_ex__(self):
         return self.__newargs
 
-    @staticmethod
     def competence(var, has_grad):
         return Competence.INCOMPATIBLE
 

Mutant 267

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -96,7 +96,6 @@
     def competence(var, has_grad):
         return Competence.INCOMPATIBLE
 
-    @classmethod
     def _competence(cls, vars, have_grad):
         vars = np.atleast_1d(vars)
         have_grad = np.atleast_1d(have_grad)

Mutant 275

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -119,7 +119,7 @@
 
     def stop_tuning(self):
         if hasattr(self, 'tune'):
-            self.tune = False
+            self.tune = None
 
 
 class ArrayStep(BlockedStep):

Mutant 276

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -135,7 +135,7 @@
     blocked: Boolean (default True)
     """
 
-    def __init__(self, vars, fs, allvars=False, blocked=True):
+    def __init__(self, vars, fs, allvars=True, blocked=True):
         self.vars = vars
         self.ordering = ArrayOrdering(vars)
         self.fs = fs

Mutant 277

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -135,7 +135,7 @@
     blocked: Boolean (default True)
     """
 
-    def __init__(self, vars, fs, allvars=False, blocked=True):
+    def __init__(self, vars, fs, allvars=False, blocked=False):
         self.vars = vars
         self.ordering = ArrayOrdering(vars)
         self.fs = fs

Mutant 278

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -165,7 +165,7 @@
     and unmapping overhead as well as moving fewer variables around.
     """
 
-    def __init__(self, vars, shared, blocked=True):
+    def __init__(self, vars, shared, blocked=False):
         """
         Parameters
         ----------

Mutant 282

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -176,7 +176,7 @@
         self.vars = vars
         self.ordering = ArrayOrdering(vars)
         self.shared = {str(var): shared for var, shared in shared.items()}
-        self.blocked = blocked
+        self.blocked = None
         self.bij = None
 
     def step(self, point):

Mutant 283

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -177,7 +177,7 @@
         self.ordering = ArrayOrdering(vars)
         self.shared = {str(var): shared for var, shared in shared.items()}
         self.blocked = blocked
-        self.bij = None
+        self.bij = ""
 
     def step(self, point):
         for var, share in self.shared.items():

Mutant 286

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -200,7 +200,7 @@
     Works by linking a list of Points that is updated as the chains are iterated.
     """
 
-    def __init__(self, vars, shared, blocked=True):
+    def __init__(self, vars, shared, blocked=False):
         """
         Parameters
         ----------

Mutant 289

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -238,7 +238,7 @@
                  dtype=None, **theano_kwargs):
         model = modelcontext(model)
         self.vars = vars
-        self.blocked = blocked
+        self.blocked = None
 
         func = model.logp_dlogp_function(
             vars, dtype=dtype, **theano_kwargs)

Mutant 297

--- pymc3/step_methods/arraystep.py
+++ pymc3/step_methods/arraystep.py
@@ -287,7 +287,7 @@
     q or q0
     """
     # Compare acceptance ratio to uniform random number
-    if np.isfinite(mr) and np.log(uniform()) < mr:
+    if np.isfinite(mr) and np.log(uniform()) <= mr:
         return q, True
     else:
         return q0, False